Sunday, December 11, 2011

Disable your screensaver while watching videos with Caffeine

Totem unfortunately doesn't support 10-bit encoded x264 videos yet. If you want to play those videos, you'll need to use a different video player than the default included with Ubuntu.

Gnome Mplayer works fine, but unfortunately it doesn't seem to prevent your monitor from going to sleep while a video is playing.

One way to work around that is to use Caffeine, a tool for disabling the screensaver manually. You can even set it to disable the screensaver only when certain apps are running.

Caffeine isn't in the Ubuntu repositories, so you'll need to add the Caffeine developers PPA:

~$ sudo add-apt-repository ppa:caffeine-developers/ppa
~$ sudo apt-get update
~$ sudo apt-get install caffeine

You can run it using Alt-F2 then running the caffeine command, or search for Caffeine in the Unity launcher. By default, it shows an app indicator on your Ubuntu desktop.

Indicators with caffeine indicator on the left
It's a couple clicks away to enable/disable your screensaver from the indicator menu.

Caffeine preferences, System Monitor, and Gnome Mplayer running
Alternatively, you can set Caffeine to start automatically on login and activate when certain apps are running. It goes by process name but you can easily find that out from System Monitor.

Caffeine will disable the screensaver when it detects an app on its list is running, and re-enable it once all said processes are no longer running.