I'm positioning a tooltip-style panel relative to the mouse pointer and need to avoid overlapping the pointer glyph itself. This works fine at the default pointer size, but breaks once the user sets System Settings → Accessibility → Pointer → Pointer size to something larger than Normal — the pointer is visibly bigger on screen, but my offset doesn't grow to match, so the tooltip overlaps it.
The only cursor-size-related value I've found any API expose is the ratio behind that same setting, read via:
/usr/bin/defaults read com.apple.universalaccess mouseDriverCursorSize
This returns a scale factor (1.0 = Normal, larger toward Large), not a size in points. I'm using it to scale a fixed offset, but that only approximates the real on-screen footprint of the pointer glyph — it doesn't tell me the glyph's actual rendered bounding box, so the tooltip still clips the pointer at larger sizes.
Question: Is there a supported API — AppKit, Accessibility, or otherwise — that returns the system pointer's actual rendered size (bounding box, in points) reflecting the user's Pointer size setting? Or is there a different recommended approach for positioning UI relative to the live pointer without overlapping it, that doesn't depend on knowing that size directly?
Minimal repro (AppKit, Swift Package Manager, no storyboard/xib — ~150 lines):
enum CursorPrefs {
static func readPointerScale() -> Double {
let process = Process()
process.executableURL = URL(fileURLWithPath: "/usr/bin/defaults")
process.arguments = ["read", "com.apple.universalaccess", "mouseDriverCursorSize"]
let outputPipe = Pipe()
process.standardOutput = outputPipe
process.standardError = Pipe()
try? process.run()
process.waitUntilExit()
let data = outputPipe.fileHandleForReading.readDataToEndOfFile()
let output = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
guard let scale = Double(output), scale >= 1.0 else { return 1.0 }
return scale
}
}
// A tracking-area view shows a tooltip-style NSPanel near NSEvent.mouseLocation,
// offset by a fixed amount scaled by the value above. At Pointer size = Large,
// the tooltip still overlaps the (visibly bigger) pointer glyph, because the
// value is a ratio, not the glyph's rendered size in points.
Steps to reproduce:
- Run the demo app (
swift run, or openPackage.swiftin Xcode and Run). - Open System Settings → Accessibility → Pointer → Pointer size and set it to Large.
- Quit and relaunch the demo (it reads the setting once at launch).
- Move the mouse over the gray box in the window.
- The floating tooltip tracks the pointer but still overlaps the now-larger pointer glyph.
Environment: macOS 14.7.8 (23H730, Xcode 16.2 (16C5032a), Swift 5.9, arm64 (Apple Silicon).
Happy to attach the full repro project as a zip if useful — it's a single main.swift plus an SPM manifest, no external dependencies.
Thanks for testing image.size as a live tooltip offset, with both linear and square-root scaling. In macOS 27.0.1, NSCursor reports the same hot spot and the same arrow image, 28 x 40 points, at each pointer size I tried. The visible pointer grows, but those values don't.
There isn't an API that reports the pointer's rendered size or the pointer size setting. NSCursor provides your app's cursor image and hot spot. The accessibility display options on NSWorkspace, such as accessibilityDisplayShouldIncreaseContrast, don't include pointer size. The com.apple.universalaccess default isn't API.
Standard tooltips do account for the setting. I gave a view a toolTip and measured where AppKit placed the tooltip. Its top edge sat about 19 points below the pointer's hot spot with Pointer size at Normal, and about 73 points below at Large. The tooltip didn't overlap the pointer at any size I tried. If your content fits in a standard tooltip, set toolTip on the view, or use addToolTip(_:owner:userData:) for an area within it. I tested in macOS 27.0.1 and haven't checked macOS 14.
If a standard tooltip doesn't do what you need, please file an enhancement request using Feedback Assistant so that your request can be seen by the appropriate decision makers. Describe the panel you're positioning and why a standard tooltip doesn't cover it. If you file the request, please post the Feedback number here so we can make sure it gets routed to the right team.
Please note that filing an enhancement request does not guarantee Apple will add any requested functionality to Apple products in the future. However, with that said, filing an enhancement request is a good way to get your ideas in front of the folks who make decisions about that sort of thing.
If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?