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 (glutSetCur
This is my solution. It places the cursor where you can't see it (in my case, in the bottom-left corner) - then, it disables the mouse, so you can't move it.
Note You could parse data from xrandr
, or put that data in an environmental on login, and then use it; that way, you won't have to have it hard coded. But, as for me, I never change my screen resolution, so 768 is OK :)
setmouse () {
DISPLAY=":0" xinput $1 `DISPLAY=":0" xinput | grep Mouse |
tr -d " " | tr "\t" " " |
cut -d" " -f2 | cut -d"=" -f2`
}
offmouse () {
DISPLAY=":0" xdotool mousemove 0 768 # use xrandr to find out
setmouse disable
}
onmouse () {
setmouse enable
}