How to get the mouse cursor disappear when playing a video

I have a qube named “video” and in it I use mpv to play video files (mp4, webm, etc.). While the video plays, the mouse cursor never disappears from the screen and always stays visible. Is there a way to get the mouse cursor disappear?

Main idea : a keyboard shortcut hides your cursor (by switching to a blank/invisible cursor).

Install a blank cursor to your cursor theme (here Adwaita):

[user@dom0 ~]$ cat blank
#define blank_width 1
#define blank_height 1
#define blank_x_hot 0
#define blank_y_hot 0
static unsigned char blank_bits[] = {
    0x00 };
[user@dom0 ~]$ sudo cp blank /usr/share/icons/Adwaita/cursors/

Test switching to the blank cursor and go back to the default cursor:

[user@dom0 ~]$ xsetroot -cursor blank blank
[user@dom0 ~]$ xsetroot -cursor_name left_ptr

Add the keyboard shortcuts: XFCE setting > Keyboard > shortcuts

  • Alt-F12 : xsetroot -cursor_name left_ptr
  • Alt-Shift-F12 : xsetroot -cursor blank blank

Usage:

  • play your video in fullscreen from your web browser or video player
  • press Alt-Shift-F12 to hide the cursor
  • when finished, press Alt-F12 to show the cursor

I daily use this solution. Anyone with another solution?

1 Like

Thanks for writing this. But this is rather convoluted. If anyone else have a simpler, more straightforward solution, I would like to hear that.

Create 1 file and 2 keyboard shorcuts is extremely complex and difficult to follow ?? :thinking:
Where did you struggle ?

You could move the cursor in one of the screen corner (except top-left).
Only 1 pixel will be visible, you shouldn’t see it while watching video.

related github issue: Hiding the mouse cursor does not work

1 Like