Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jcs/xbanish
Hide the mouse cursor when typing and show it again when the mouse moves
https://github.com/jcs/xbanish
x11 x11-cursor xinput
Last synced: about 2 months ago
JSON representation
Hide the mouse cursor when typing and show it again when the mouse moves
- Host: GitHub
- URL: https://github.com/jcs/xbanish
- Owner: jcs
- License: other
- Created: 2013-02-28T21:03:45.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2023-08-09T16:11:03.000Z (over 1 year ago)
- Last Synced: 2024-04-14T02:19:43.183Z (9 months ago)
- Topics: x11, x11-cursor, xinput
- Language: C
- Homepage:
- Size: 39.1 KB
- Stars: 507
- Watchers: 16
- Forks: 63
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## xbanish
xbanish hides the mouse cursor when you start typing, and shows it again when
the mouse cursor moves or a mouse button is pressed.
This is similar to xterm's `pointerMode` setting, but xbanish works globally in
the X11 session.unclutter's -keystroke mode is supposed to do this, but it's
[broken](https://bugs.launchpad.net/ubuntu/+source/unclutter/+bug/54148).
I looked into fixing it, but unclutter was abandoned so I wrote xbanish.The name comes from
[ratpoison's](https://www.nongnu.org/ratpoison/)
"banish" command that sends the cursor to the corner of the screen.### Implementation
If the XInput extension is supported, xbanish uses it to request input from all
attached keyboards and mice.
If XInput 2.2 is supported, raw mouse movement and button press inputs are
requested which helps detect cursor movement while in certain applications such
as Chromium.If Xinput is not available, xbanish recurses through the list of windows
starting at the root, and calls `XSelectInput()` on each window to receive
notification of mouse motion, button presses, and key presses.In response to any available keyboard input events, the cursor is hidden.
On mouse movement or button events, the cursor is shown.xbanish initially hid the cursor by calling `XGrabPointer()` with a blank
cursor image, similar to unclutter's -grab mode, but this had problematic
interactions with certain X applications.
For example, xlock could not grab the pointer and sometimes didn't lock,
xwininfo wouldn't work at all, Firefox would quickly hide the Awesome Bar
dropdown as soon as a key was pressed, and xterm required two middle-clicks to
paste the clipboard contents.To avoid these problems and simplify the implementation, xbanish now uses the
modern
[`Xfixes` extension](http://cgit.freedesktop.org/xorg/proto/fixesproto/plain/fixesproto.txt)
to easily hide and show the cursor with `XFixesHideCursor()` and
`XFixesShowCursor()`.