How to replace Gnome Screensaver with Xscreensaver on Ubuntu

By default, your Ubuntu systems are running the Gnome Screensaver application. In recent past, the Gnome developers have altered the application in a way that it only runs a blank screen when your Ubuntu screen remains idle for a specific time. You can verify that this application is running on your system by entering the following command in your Ubuntu command line, the Terminal:

$ gnome-screensaver

Gnome Screensaver

However, we are so used to running those moving patterns and images on our idle screens, such as on Windows and Mac, that we miss them on Ubuntu. Initially, these screensavers were your operating system’s way of limiting Phospor burning on plasma and CRTs. With modern display screens, this is not the case but when we miss something, there should be a way to get it back!

In this article, we will describe how you can install the Xscreensaver utility, automatically enable it at startup, and use it to set screensavers on your system depending on your specific requirements.

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.

Install Xscreensaver

The Xscreensaver package is available in the official Ubuntu repositories (ubuntu-bionic-universe) and can easily be installed through the command line using the apt-get command.

Open your Terminal application either through the system Application Launcher Search or through the Ctrl+Alt+T shortcut.

The next step is to update your system’s repository index through the following command:

$ sudo apt-get update

Update package list

This helps you in installing the latest available version of a software from the Internet. Please note that only an authorized user can add, remove and configure software on Ubuntu.

Now you are ready to install the Xscreensaver, and some required packages; you can do so by running the following command as sudo:

$ sudo apt-get install xscreensaver xscreensaver-gl-extra xscreensaver-data-extra

Install Xscreensaver

The system might ask you the password for sudo and also provide you with a Y/n option to continue the installation. Enter Y and then hit enter; the software and the relevant packages will then be installed on your system. The process may, however, take some time depending on your Internet speed.

In order to verify that the software is indeed installed on your system and also to get the version information, run the following screensaver command:

$ xscreensaver -help

Check XScreensaver version

Removing the default Ubuntu Screensaver

As mentioned above, the default Gnome Screensaver would only display a blank screen when your system is idle for a long time. For the system to not use this screensaver app anymore, let us remove it through the following command:

$ sudo apt-get remove gnome-screensaver

Remove Sscreensaver

Important: For this screen saver application to be removed completely, you need to restart your system.

Add Xscreensaver to Autostart

The Xscreevsaver now appears in the Applications listing and can be launched anytime. However, we would not like starting it every time we reboot our system in order for the screen saver program to be active. Thus, it is best to add the Xscreensaver utility to your system startup.

Open the Startup Applications utility either by locating it in the Applications list or simply by searching for it through the system Application Launcher search as follows.

Startup app

Note: Although I have been using the Startup Applications utility for a long time, I could not find it installed on my Ubuntu while working on this article. If you ever face a similar situation, you can add this app back to your system through the following command:

$ sudo apt-get install gnome-startup-applications

The application can also be launched through the Terminal by running the following command:

$ gnome-session-properties

When the Startup Applications utility opens, click the Add button to add a new program to startup.

In the Add Startup Program dialog, enter the following information:

Name: screensaver

Command: xscreensaver -nosplash

The nosplash flag would mean that the application would run without the UI being displayed

Comment: start screensaver app at startup (or any other relevant comment)

Add startup item for Xscreensaver

Now click the Add button. Every time you boot the system, this startup program will start running the Xscreensaver utility so that your screensaver becomes active the way you have configured it.

How to Set up a Screensaver

In order to set a screensaver through the Xscreensaver utility, open the application either through the Application Launcher search as follows:

xscreensaver

Or, through the following Terminal command:

$ xscreensaver

The application will open in the following view when you open it for the first time:

Screensaver preferences

Click OK, if you get a dialog as shown above in order to run Xscreensaver on your current display screen. By default, this screen saver utility will run random screensavers on your system when the screen is idle for 10 minutes. It will also change the screensavers randomly, after every 10 minutes.

Display modes

Through the Mode drop-down, you can even configure the utility to set up only one screensaver and select that one screensaver from the list you can see under “Mode”. You can also set the idle time after which the screensaver will run through the 'Blank After' option. If you explore the utility some more, you will learn that there are many other configurations you can make to the behavior of your screensaver through the Xcreensaver.

Go Back to the Gnome-Screensaver

If for any reason, you want to remove the Xscreensaver utility and switch back to the default Gnome Screensaver application, please follow these steps:

1. Remove the Xscreensaver utility and the relevant packages, you added while installing the Xscreensaver, through the following command in your Terminal:

$ sudo apt-get remove xscreensaver xscreensaver-gl-extra xscreensaver-data-extra

2. Install the Gnome Screensaver utility through the following command:

$ sudo apt-get install gnome-screensaver

3. Remove Xscreensaver app from your Startup Applications.

You do not need to add the Gnome Screensaver to your system startup as the application is meant to automatically run at all times. You can verify this by running the following command:

$ gnome-screensaver

Gnome Screensaver

4. Restart your system.

This was all you needed to know about installing the Xscreensaver application. You can now choose from a list of screensavers to run, whenever your Ubuntu screen is idle for a time specified by you.