Hiding the mouse cursor dynamically when using the touchscreen

xinputxorg

I have a touchscreen laptop and I want to hide the pointer whenever I touch the screen. I am aware of solutions like unclutter and startx -nocursor but I want the pointer to hide/show dynamically, hiding if I use the touchscreen and showing when I use a hardware mouse.

I thought about making two separate pointers and applying one of the two above solutions to the touchscreen pointer, but neither of those solutions mention how to target a single pointer, and having multiple pointers makes things act weird, and that wouldn't hide the hardware mouse cursor.

I figure I can most reasonably do this doing something like this, keeping track of the current input mechanism and executing xinput -cursor [transparent cursor] whenever the touchscreen is used and xinput -cursor [normal cursor] whenever a normal mouse is used.

I looked at xinput though and it looks like since both the hardware mouse and touchscreen are slaved to the same pointer, both of them register the same events in xev so I'm not really sure where I would get the information needed to differentiate a touch from a mouseclick. is it possible?

Best Answer

You could use

To use, install it

sudo apt-get install unclutter

then run it

unclutter -idle 0.01 -root

Note that the number after idle means the time before it hides. In this case its set to 1/100 of a second. You could try change it to a value that it would always be hidden.

This will hide the cursor when you don't move it. I'm sure there is also an option to completely hide it.

Related Question