https://github.com/mte90/wcentermouse
Center the mouse with uinput on Wayland
https://github.com/mte90/wcentermouse
Last synced: 12 months ago
JSON representation
Center the mouse with uinput on Wayland
- Host: GitHub
- URL: https://github.com/mte90/wcentermouse
- Owner: Mte90
- License: gpl-3.0
- Created: 2025-02-07T16:24:07.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-07T16:26:29.000Z (over 1 year ago)
- Last Synced: 2025-06-28T22:05:44.339Z (12 months ago)
- Language: C++
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# WCenterMouse
[](http://www.gnu.org/licenses/gpl-3.0)
Utility to center the mouse pointer on the screens, tested in Wayland.
Based on ChatGPT and Co-Pilot code and improved manually.
As Wayland doesn't support aboslute position for mouse and in a multi monitor environment is not good, we set a big negative position initially to set a different later.
The program require the size of the various monitor configured in the source code.
Note: xdotool is only for Xorg and ydotool not works well for the same reason with multi monitors environment.
## Compile
```
g++ main.cpp -o wcentermouse
```
## Use it
as root:
```
visudo wcentermouse
```
With this automatically sudo will execute it without asking the password and also sharing the XDG runtime variable.
```
ALL ALL=(root) NOPASSWD: /path/wcentermouse
Defaults env_keep += "XDG_RUNTIME_DIR"
```
Run
```
sudo ./wcentermouse 1/2/3/etc
```