Disabling the screensaver on Ubuntu 14.04


System Settings

In Ubuntu Linux for some years there has been a great little utility to disable/enable the screensaver called caffeine. In the latest version the developer decided to remove the applet altogether from the tray. The application basically works in the background and detects if an application is in full screen or not.

But as seen in this discussion here there are many of us that relied on that simple way of manually turning on and off the screensaver quickly. The developer is unwilling to revert back to the previous functionality, which he/she is entitled to do so. I have found a round about way to supplement the current functionality of caffeine by using custom keyboard shortcuts.

There are two drawbacks to this method;

  1. The screensaver does not revert back to on upon reboot (may be a desired functionality for some use cases)
  2. There is still no indicator to tell you if it is disabled or not


Open your settings control panel and go to “Keyboard”Keyboard_059

Select “Custom Shortcuts”Keyboard_061


Click on the “+”to add a new custom shortcut.Keyboard_061


Give your new shortcut a name like “Disable Screensaver”Keyboard_063


Add the following to the command field: The “0” denotes zero seconds before the screen turns black, 0=never.

gsettings set org.gnome.desktop.session idle-delay 0



After clicking “Apply”, you will see that the new shortcut says “Disabled”, this is because it does not yet have a shortcut assigned to it.  Keyboard_065


Highlight the new shortcut and then select your keyboard shortcut combination. I used the
Control key + the Win key + the letter “S”, but you can use what ever you like even “F” Keys.
But keep in mind that if that combination is already used in one of the other shortcuts, they will take precedence over your shortcut.Keyboard_066


Now add another keyboard shortcut to enable the screensaver again, use the same command but change the number at the end to 600:
This will enable the screensaver back on at 10 minutes (10 X 60 seconds)

gsettings set org.gnome.desktop.session idle-delay 600



Now add your keyboard shortcut combination to enable the screensaver, I used Ctrl+Super+EKeyboard_068


Now you MUST LOG OUT and log back in for it to take effect!

You can verify that it works by disabling the screensaver with your new shortcut  then opening the System Settings> Brightness & Lock  and then close the window. Then enable the screensaver and go back to Brightness & Lock and it should be enabled again.


As I noted above, if one forgets to turn the screen settings back on, this can be remedied by adding a simple shell script at login.

I recommend you create a directory in your home folder called “Scripts“, inside create a new document called “EnableScreen.sh“.
Open the new file and add the same code used for the keyboard shortcut and should look like the following:

gsettings set org.gnome.desktop.session idle-delay 600
exit 0

Save the document and make it Executable by right clicking on the file, go to properties and checking “Execute”.

EnableScreenBlank.sh Properties_077

Then open the “Startup Applications” from your Applications and add a new command to run the new script.
After you browse to the file  from the command field, add “sh” at the beginning of the command. For example, my command looks looks like this:

sh /home/joao/Scripts/EnableScreenBlank.sh

Startup Applications Preferences_076Another drawback is that this will always reset the time to 10 minutes at every login,
so if you want to change the setting, you have to change the script time.

So now, Caffeine will turn off the screen if any program goes into full screen mode, you can manually
turn on or off the screen but in case you forget, it will reset on next login, reboot is not required, only to login.

Someone should write a program that does this…sarcasm!


UPDATE: 2014/08/18

A fork of the original Caffeine 2.7 has been created which adds the deleted functionality.
The new project is called Caffeine Plus https://github.com/mildmojo/caffeine-plus


UPDATE: 2014/08/26

WEBUPD8 has a PPA for Cafeeine-plus





3 thoughts on “Disabling the screensaver on Ubuntu 14.04 (caffeine)

What's on your mind?