Bringing Sexy Back: Video screensavers in Ubuntu and Gnome Shell

Technically screensavers are no longer required as modern displays are not susceptible to burn in from displaying the same image as older CRT monitors. Gnome shell has therefore not developed a screensaver function into gnome-shell, simply opting for a blank screen which when a user interacts requires them to login into the computer for security purposes. So Why still use them? Because they look cool. Although as stated Gnome Shell doesn’t support them the can still be used via the xscreensaver package. This package is capable of displaying a number of included open-gl powered screensavers. It can, however, play videos with a few tweaks using VLC.

The only downside to using this is the lack of native lock screen dialog. It instead renders a very bad looking unlock option. This leaves the user with three options to work around this, either,

a) Turn It off although xscreensaver will prevent the machine from locking.

b) Theme the unlock dialog although options are limited.

c) Listen to changes in the state of xscreensaver and then lock the screen when xscreensaver unblanks.

Themeing the dialog would be the more sensible option to retain the security of the user. although aesthetically it would still look out of place. The Next best option is to invoke the gnome lock screen when xscreensaver changes state. On older hardware, it may briefly display the desktop between the screensaver turning off and when the lock screen is invoked.

Installing xscreensaver

Xscreensaver is a nifty little program that over 25 years old is still being actively maintained by the original author, It’s old but not obsolete. The Cinnamon desktop for example still uses it as a backend for their screensaver packages. The version available in the repositories isn’t the most up to date. So lets install it from a PPA. Open a terminal from your app menu or with Ctrl+Alt+T and enter.

sudo add-apt-repository ppa:hda-me/xscreensaver

Packages are available for Bionic (18.04) and Xenial (16.04) but are compatible with other releases such as cosmic (18.10) by changing the release in the software sources to bionic, or manually downloading and installing the .deb packages from the PPA.

Install from the PPA by typing

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

This will install xscreensaver and a selection of screensavers to get you started. If you want to use it without screen locking or by using the built-in screen locker then simply add an entry to start up applications with the name xscreensaver and the command xscreensaver -nosplash


Remove the gnome-screensaver

Since xscreensaver is now taking over the duties we can go ahead and remove gnome-screensaver. simply type

sudo apt-get remove gnome-screensaver

Configuring your screensaver

Open the screensaver configuration window from your app launcher and you may be greeted with a a warning about xscreensaver not running. If so click the launch button to activate it.


from here you can choose one of the bundled screensavers and alter its settings. Select when you want it to trigger by changing the Blank After value, Envoke the built-in lock screen by selecting the lock screen option and choosing its corresponding delay value. Check that all is ok by triggering the screensaver with the Preview button.

Using The built-in Gnome Lock Screen

It’s possible to set up a bash script to monitor the state of changes in xscreensaver responses are blank, unblank and lock. In this case, we will set up a script to run at startup to launch xscreensaver and keep it active in the background, the script will then monitor for the unblank change and trigger the gnome lock screen.

Open a text editor such as gedit and enter the following script:

xscreensaver -nosplash &
process() {
while read input; do
  case "$input" in
    UNBLANK*) dbus-send --type=method_call --dest=org.gnome.ScreenSaver \
    /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock;;
/usr/bin/xscreensaver-command -watch | process
save the file in your home directory as (ideally in a new folder named screensavers). Set the file as executable by right-clicking on it in the file manager and selecting “Allow executing file as program”.
Now we need to edit the startup applications list, as shown above, but as an alternative to setting the command as xscreensaver -nosplash, set the command line option to /home/YOURUSERNAME/screensavers/
Reboot your machine and test it out by pressing the preview button in the xscreensaver options.

But wait you said VIDEO screensavers

And you would be right, xscreensaver has the option to run other programs when it starts, in this case, VLC via the command line (cvlc). Generally, if VLC can play it from the command line then you can have it as a screensaver.

Make sure VLC is installed via the software centre or in the terminal with

sudo apt-get install vlc

To add the option you need to edit the .xscreensaver file in your home directory. and add the following to the list of programs at the bottom.

 "Videos" cvlc --loop --fullscreen      \
 --drawable-xid $XSCREENSAVER_WINDOW      \
 --no-video-title-show      \
 /pathtoyour/video.mp4    \n\

Want it to play more than one video? No problem simply create an m3u playlist and change the entry in .xsreensaver to:
 "Videos" cvlc --loop --fullscreen       \
 --drawable-xid $XSCREENSAVER_WINDOW      \
 --no-video-title-show      \
 /pathtoyour/videoplaylist.m3u    \n\
Videos will play with audio, if you want them to play without simply append the –no-audio tag after –fullscreen.


We need to stop the screen from blanking before the screensaver activates. If it blanks before the time set by xscreensaver, the user has to unblank the screen and log in, xscreensaver will automatically be active, stopping it will trigger the lock screen requiring the user to unlock the screen again.

Go to gnome settings via the app menu. and click on the power option. Set the Blank screen option to never as the option only goes up to 15 minutes.

Next, go to the Privacy option and select Screen Lock, turn the option for automatic screen lock to off as xscreensaver is now triggering this function.

Now sit back and enjoy screensaver goodness! Got a view on using screensavers, would you like the function built back in by default or do you think they should stay in the past. Let us know in the comments below.






%d bloggers like this: