A Swift package for macOS that provides precise cursor positioning and contextual information about focused applications and windows.
CursorBounds is a comprehensive Swift package that gives you precise information about:
- Where the text cursor is - Position, and bounds of the text caret, text field, or mouse cursor
- What app is focused - Identify the current application and window
- Browser context - Extract URLs, domains, and page titles from web browsers
- Smart positioning - Calculate optimal popup and overlay positions based on cursor position and size
Get exact cursor coordinates with intelligent fallback:
![]() |
![]() |
![]() |
|---|---|---|
| Text Caret | Text Field Bounds | Mouse Cursor |
| Precise blinking cursor position | Focused text area rectangle | Screen cursor as fallback |
Understand what the user is doing:
- Detect focused applications and windows
- Extract website URLs and domains from browsers
- Identify search fields and page titles
- Configurable browser detection (18+ browsers supported)
📖 Complete Documentation available in the CursorBounds Wiki
| Requirement | Status | Description |
|---|---|---|
| Accessibility Permissions | 🔴 Required | Must be granted to use this package. The system will prompt users to grant these permissions. |
| App Sandbox (Internal Use) | 🟢 Optional | Can remain enabled when tracking cursors within your own application. |
| App Sandbox (External Use) | 🚨 Must be disabled | Required only if you need to track cursors in other applications (external apps). |
CursorBounds comes with a bundled demo app that lets you explore CursorBounds in action. Open the Xcode workspace, select the CursorPlayground target, and press Run to try it out.
The Current Origin tab continuously displays the live caret position (or the best fallback) and lets you monitor changes in real-time.
The Capture Timer tab records cursor positions at a configurable interval, useful for sampling cursor movement over time.
CursorPlayground also features a pop example, while the app is running, pressing the configured keyboard shortcut will display a popup using the smart positioning method (see Smart Positioning). You can customize the keyboard shortcut in the Popup settings tab.
This project is released under the MIT License. See LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request! See CONTRIBUTING.md for guidelines.
If you like this project, please consider giving it a ⭐️
Built with 🍏🖱️🔲 by Aether




