Configure screensaver in Ubuntu
Starting with 12.04, Ubuntu doesn't ship with any screensavers, just a black screen that appears when your system is idle. If you’d rather have screensavers, you can swap gnome-screensaver for XScreenSaver.
Screensavers were actually removed back in Ubuntu 11.10. Ubuntu uses gnome-screensaver and inherited the change from upstream GNOME. The GNOME developers think a black screen that puts your monitor into lower-power mode is optimal.
Installing XScreenSaver
Open a terminal and run the following command to uninstall gnome-screensaver:
sudo apt-get remove gnome-screensaver
Install XScreenSaver and some additional screensaver packages with the following command:
sudo apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl-extra
Configuring your screensaver
After installation, perform a search in the Dash for Screensaver. Launch the Screensaver utility and use it to configure XScreenSaver and select your screensaver settings.
The Screensaver utility will prompt you to stop the gnome-screensaver process and launch the xscreensaver background process when you start it.
By default, XScreenSaver will choose a random screensaver each time it starts. You can specify the screensavers it chooses from or enable "Only One Screensaver" mode to always use your favorite screensaver.
Adding to Startup
To actually use the screensavers, you'll want XScreenSaver to start in the background each time you log in. If it doesn’t start, it can’t notice your system is idle and launch screensavers.
Get started by launching the Startup Applications utility from the Dash. Add a startup program with the following command. The name and comment here can be anything you like:
xscreensaver -nosplash
Reverting Your Changes
Reverting these changes is simple. Just run these commands to uninstall XScreenSaver and reinstall gnome-screensaver:
sudo apt-get remove xscreensaver xscreensaver-data-extra xscreensaver-gl-extra
sudo apt-get install gnome-screensaver
Source and more about: How to Add Screensavers to Ubuntu 12.04.
no, you don't have to uninstall gnome-screensaver, and install xscreensaver. You can just go to System Settings -> Brightness and Lock to setup the idle time of gnome-screensaver. The gnome-screensaver can put your LCD monitor into low activity mode so it is the best for your monitor.
Radu's answer is a good one so I won't duplicate it. I will point out extra steps recommended by the xscxreensaver
developer. I'm also including a short paragraph of history from the developer.
USING GNOME OR UNITY
For the better part of a decade, GNOME shipped
xscreensaver
as-is, and everything just worked out of the box. In 2005, however, they decided to re-invent the wheel and ship their own replacement for the xscreensaver daemon called "gnome-screensaver", rather than improving xscreensaver and contributing their changes back. As a result, the "gnome-screensaver" program is insecure, bug-ridden, and missing many features of xscreensaver. You shouldn't use it.To replace gnome-screensaver with xscreensaver:
Fully uninstall the gnome-screensaver package.
sudo apt-get remove gnome-screensaver
Launch xscreensaver at login.
Select "Startup Applications" from the menu (or manually launch "gnome-session-properties") and add "xscreensaver".
Make GNOME's "Lock Screen" use xscreensaver.
sudo ln -sf /usr/bin/xscreensaver-command /usr/bin/gnome-screensaver-command
That doesn't work under Unity, though. Apparently it has its own built-in screen locker which is not gnome-screensaver, and cannot be removed, and yet still manages to be bug-addled and insecure. Keep reinventing that wheel, guys! (If you have figured out how to replace Unity's locking "feature" with xscreensaver, let me know.)
Turn off Unity's built-in blanking.
Open "System Settings / Brightness & Lock";
Un-check "Start Automatically";
Set "Turn screen off when inactive for" to "Never."
Disclaimer
I do not agree with the strong language of the developer but felt it better to include the history rather than hide it.
Ubuntu 18.04 special notes
Many have complained when locking screen with Ctrl+Alt+L external monitors blank instantly and those with dpms are switched off. This causes unwanted delays when unlocking screen. Using xscreensaver
will circumvent that particular problem.
You can decommission the Ctrl+Alt+L shortcut from gnome-screensaver
and assign it to a new command for xscreensaver
:
xscreensaver-command -lock
This keyboard shortcut reassignment also works in Ubuntu 16.04.