https://github.com/mnoomnoo/cursorlocker
Keeps the cursor inside the boundary of the primary monitor if the specified executable is already a process or when it becomes a process.
https://github.com/mnoomnoo/cursorlocker
cpp cursor cursor-boundary cursor-lock cursor-movement cursor-position fullscreen fullscreen-mode lock-cursor monitor multi-monitor screen windows
Last synced: about 2 months ago
JSON representation
Keeps the cursor inside the boundary of the primary monitor if the specified executable is already a process or when it becomes a process.
- Host: GitHub
- URL: https://github.com/mnoomnoo/cursorlocker
- Owner: mnoomnoo
- License: mit
- Created: 2021-05-03T02:33:41.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-05-01T04:04:37.000Z (about 3 years ago)
- Last Synced: 2025-06-02T02:19:23.478Z (about 1 year ago)
- Topics: cpp, cursor, cursor-boundary, cursor-lock, cursor-movement, cursor-position, fullscreen, fullscreen-mode, lock-cursor, monitor, multi-monitor, screen, windows
- Language: C++
- Homepage:
- Size: 71.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CursorLocker
This program locks the cursor to the the primary monitor when the specified executable starts running. Once the specified executable quits then the cursor is unlocked.
On multi-monitor systems the primary monitor shares a vertical or horizontal edge with another monitor. In some fullscreen applications its possible to move your mouse cursor outside the boundary of the primary monitor. If a click occurs while the cursor is outside the boundary of the primary monitor then Windows will sometimes interact with the click instead of the fullscreen application and cause the application to minimize or worse.
## Usage:
`CursorLocker.exe [OPTIONS]`
## Options:
_**-h, -help**_ := Print version and help info then exits
_**-ec, -exesConfig**_ := Loads the exesConfigs.ecfg file which contains a list of executable files to search for. First exe in that list that becomes a process or is already a process triggers the cursor to lock to the primary monitor. Ignores the passed in.
_**-sleepTime \**_ := How long to sleep before a CursorLocker processing iteration. Default is 800 ms
## Usage example:
`CursorLocker.exe SomeFullscreenApplication.exe`
The above will start CursorLocker.exe and see if SomeFullscreenApplication.exe is currently a process. If it's currently a process then the cursor will immediately be locked to the primary monitor. If SomeFullscreenApplication.exe isn't a process then CursorLocker.exe will wait to lock the cursor until SomeFullscreenApplication.exe becomes a process
## How to build
1. Open the repo folder in your favorite IDE
2. Run cmake to configure the project
3. Build All
## Thanks
The CursorLocker icon is derived from an icon found on game-icons.net and made by Lorc, http://lorcblog.blogspot.com
## License
MIT