Hide Mouse

I rarely use mouse, in fact, since 2008 I don’t even have a mouse. After I bought my first notebook, the most I use to move the cursor is a graphics tablet, my keyboard shortcuts, and the touchpad when I’m not too far from the notebook.

The problem is that often the cursor gets in the way of what I’m doing, and I need to hide it somehow. In this post, I will show two simple solutions to this problem.

1. Move the cursor

The simplest solution is to move the cursor to the corner of the screen, where it doesn’t bother me. Until recently, moving the cursor meant moving my hand away from the keyboard or keep pressing my shortcut key that moves only 10 pixels at a time. This was solved with xdotool:

First, install the program:

sudo pacman -S xdotool

Move the cursor to the upper left corner:

xdotool mousemove 0 0

Move the cursor to the upper right corner (assuming your screen is not larger than fullHD):

xdotool mousemove 1920 1080

To avoid typing this in the terminal, I included this command in my shortcuts in .xbindkeysrc:

# Move to bottom right corner
"xdotool mousemove_relative 1920 1080"
KP_Begin

The KP_Begin corresponds to the 5 key on my numeric keypad.

Hide the cursor when inactive

We can use unclutter to hide the cursor.

Install unclutter:

sudo pacman -S unclutter

Just type unclutter & in the terminal. The default is to hide the mouse after 5s of inactivity. Some options can also be useful:

noevents - Does not send EnterNotify event. May not work well with some programs:

unclutter -idle 5 -noevents &

grab - I noticed that it couldn’t hide the cursor when it was over Pidgin in AwesomeWM (the cursor kept flashing). This command changes the method of grabbing the cursor to hide:

unclutter -grab

Note:

  • Place these commands in .xinitrc so they are executed when X starts.
  • Some programs like xtrlock will only work when the mouse is visible

Julio Batista Silva
Julio Batista Silva
Data Engineer

I’m a computer engineer passionate about science, technology, photography, and languages. Currently working as a Data Engineer in Germany.

comments powered by Disqus