How to Install and Autostart XScreenSaver on Ubuntu 16.04, 16.10

XScreensaver is a screen saver and locker for X11. This tutorial shows you how to install XScreenSaver on Ubuntu 16.04, 16.10 and how to autostart it at boot time.

Install XScreenSaver from Ubuntu Repository or PPA

Install xscreensaver from Ubuntu repository with:

sudo apt install xscreensaver

To install the latest version, you can use the following PPA.

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

sudo apt update

sudo apt install xscreensaver

To check your XScreenSaver version, execute the following command:

xscreensaver --help

install xscreensaver on ubuntu 16.04

Now you can start XScreenSaver demo program from Unity Dash or your preferred App launcher.

xscreensaver ubuntu

The demo program will ask you to start XScreenSaver daemon. Click OK to start the daemon.

xscreensaver settings

How to Get XScreenSaver Autostart at boot time

Since Ubuntu comes preloaded with gnome-screensaver, which is a fork of XScreenSaver, we need to remove gnome-screensaver in order to autostart XScreenSaver at boot time.

sudo apt remove gnome-screensaver

Then open startup applications.

ubuntu startup applications

Add a new startup entry like below. Enter xscreensaver -nosplash in command field.

xscreensaver ubuntu startup

Reboot your computer and XScreenSaver daemon should be automatically started. When you open XScreenSaver demo program again, it won’t tell you to start the daemon because the daemon has already been started.

Autostart with Systemd service

We can also get XScreenSaver autostart at boot time with Systemd, which is used by Ubuntu since 15.04.

First, execute the following command to create a directory for storing Systemd service file of individual users.

mkdir -p ~/.config/systemd/user/

Then create xscreensaver.service file with nano text editor.

nano ~/.config/systemd/user/xscreensaver.service

Put the following text into the fie.

[Unit]
Description=XScreenSaver
[Service]
ExecStart=/usr/bin/xscreensaver -nosplash
[Install]
WantedBy=default.target

Press CTRL+O to save the file. Press CTRL+X to exit out of nano text editor. Finally, enable this service so that XScreenSaver will be automatically started at boot time.

systemctl --user enable xscreensaver

That’s it!

I hope this tutorial helpd you install and autostart XScreenSaver on Ubuntu 16.04/16.10 As always, if you found this post useful,  subscribe to our free newsletter or follow us on Google+Twitter or like our Facebook page.

Rate this tutorial
[Total: 29 Average: 4.7]

2 Responses to “How to Install and Autostart XScreenSaver on Ubuntu 16.04, 16.10

  • Bingo! I was able to install xscreensaver and start it manually but could not get it to autostart (start at boot time) until I read this article. Thanks for the advice Xiao 🙂

    To get xscreensaver to autostart, I used the Startup Applications method as outlined above.

  • will this work with kubuntu as well?

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here