Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you hide the mouse pointer under Linux/X11?

Tags:

linux

x11

mouse

How do I hide the mouse pointer under X11? I would like to use the built in libraries in order to do this and not something like SDL (SDL_ShowCursor(0)) or glut (glutSetCursor(GLUT_CURSOR_NONE)). Also, the mouse pointer should be hidden no matter the pointer location, not just in its own window.

like image 755
rck Avatar asked Mar 19 '09 00:03

rck


People also ask

How do I make my mouse pointer hide?

You will see a “Mouse Properties” window. At the top of this window, click the “Pointer Options” tab. The “Pointer Options” tab displays various mouse settings. Here, in the “Visibility” section, enable the “Hide Pointer While Typing” option.


1 Answers

Here's a description how unclutter utility does it.

Unclutter is a program which runs permanently in the background of an X11 session. It checks on the X11 pointer (cursor) position every few seconds, and when it finds it has not moved (and no buttons are pressed on the mouse, and the cursor is not in the root window) it creates a small sub-window as a child of the window the cursor is in. The new window installs a cursor of size 1x1 but a mask of all 0, ie an invisible cursor. This allows you to see all the text in an xterm or xedit, for example. The human factors crowd would agree it should make things less distracting.

Once created, the program waits for the pointer to leave the window and then destroys it, restoring the original situation. Button events are passed transparently through to the parent window. They will usually cause the cursor to reappear because an active grab will be made by the program while the button is down, so the pointer will apparently leave the window, even though its x y position doesnt change.

like image 84
Eugene Morozov Avatar answered Nov 07 '22 11:11

Eugene Morozov