Ubuntu – How to enable -keystroke option of unclutter in unity

autohidekeyboardmouse

Recently I installed unclutter to hide the mouse pointer while I'm typing, since there is no option in Ubuntu 14.04 to hide mouse pointer. According to the man pages of unclutter ther is a option -keystroke that wait until a key has been pressed and hides the pointer. But my problem is that it doesn't work by running this command:

unclutter -keystroke &

Another hint in the man pages is that:

LIMITATIONS:
The -keystroke option may not work (that is, the cursor will not disappear) with
clients that request KeyRelease events. Games and Xt applications using KeyUp
in their translation tables are most likely to suffer from this problem. The
most feasible solution is to extend unclutter to use the XTest extension to get
all keyboard and mouse events, though this of course requires XTest to be in the
server too.

The -keystroke option does not distinguish modifier keys from keys which actu‐
ally generate characters. If desired this could be implemented in a simple way
by using XLookupString to see if any characters are returned.

I must tell that I wouldn't like a timer for hiding mouse when it's idle. I would like it work like the windows.

Best Answer

You can use xbanish to do this. It is well known that the unclutter keystroke function has been broken for quite some time. I have tested this solution and it works well.

First, install git if it's not already installed:

sudo apt-get update
sudo apt-get install git build-essential libxtst-dev x11proto-core-dev

Then, clone the repo and install xbanish:

cd
git clone https://github.com/jcs/xbanish.git
cd xbanish
make

Now, set an alias for xbanish:

echo "alias xbanish='~/xbanish/xbanish &'" | tee -a ~/.bashrc
. ~/.bashrc

You can now run xbanish by simply running the following command:

xbanish

or

~/xbanish/xbanish &

Additionally, here's a helpful tip that has helped me so much when it comes to "no such file" errors.

You can use apt-file search to find out what package contains a file you are looking for. Here's an example: apt-file search X11/X.h

However, apt-file needs to be installed and you must run sudo apt-file update before you can use it:

sudo apt-get install apt-file 

and then run:

sudo apt-file update
Related Question