Hide the mouse cursor when typing and show it again when the mouse moves
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

C 68.7%
Makefile 8.0%
Roff 6.7%
Other 16.5%
24 1 9

Clone this repository

https://tangled.org/jcs.org/xbanish https://tangled.org/did:plc:6ashubrd3ihfmnrpsatviswa/xbanish
git@git.jcs.org:jcs.org/xbanish git@git.jcs.org:did:plc:6ashubrd3ihfmnrpsatviswa/xbanish

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README
xbanish
by joshua stein <jcs@jcs.org>
===============================================================================

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[0].  I
looked into fixing it, but the unclutter source code is terrible, so I wrote
xbanish in a few hours.

The name comes from ratpoison's "banish" command that sends the cursor to the
corner of the screen.


Implementation
===============================================================================

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.  When a key press occurs, the cursor is hidden.  When
the mouse moves or a button is pressed, 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[1] to easily hide and show the cursor with
XFixesHideCursor() and XFixesShowCursor().


0. https://bugs.launchpad.net/ubuntu/+source/unclutter/+bug/54148
1. http://cgit.freedesktop.org/xorg/proto/fixesproto/plain/fixesproto.txt