XScreenSaver is great. However, building it needs a little meticulous so as not to cause conflict in the system when the screensaver activates. If you want to build the package yourself, follow the instructions below:
1) Package configuration
./configure --prefix=/usr --with-systemd
2) Compiling
make
3) Installing
Run the following installation command, as the root
user:
make install
The package has been configured using the libsystemd
library and the compilation process creates an xscreensaver-systemd
helper program. However, the default installation does not copy this program file. Therefore you need to install it manually, as a root
user:
cp driver/xscreensaver-systemd /usr/bin/
4) Creating user service
You create the xscreensaver
service as follows, as the root
user:
cat > /usr/lib/systemd/user/xscreensaver.service << "EOF"
[Unit]
Description=XScreenSaver
ConditionGroup=users
[Service]
ExecStart=/usr/bin/xscreensaver -no-splash
Restart=on-failure
RestartSec=30s
[Install]
WantedBy=default.target
EOF
When the service is run, there will be xscreensaver-systemd
process in addition to xscreensaver
process
Configuration without using libsystemd
On systems with systemd, XScreenSaver is configured by default to use libsystemd. That means the --with-systemd
option is not needed. However, if you don't want to use libsystemd you need to explicitly configure --without-systemd
:
./configure --prefix=/usr --without-systemd
Note when using XScreenSaver
XScreenSaver demo programs are programs that draw graphics demos. They are in the directory /usr/libexec/xscreensaver
Some programs may crash. You can disable them via configuration, for example, disable the glhanoi
program:
sed -i '/glhanoi/s,^ ,-,' ~/.xscreensaver
You can also do that through the xscreensaver-demo
program.
If there is still a problem, remove all OpenGL display modes of the demo programs that have been marked as GL: by default
sed -i 's,GL:, ,' .xscreensaver
An important configuration item is Cycle After
. That is the life cycle of a demo program. After this time, the process of the current program will be killed and replaced with the new demo program
This value must be set to be less than or equal to and be a divisor of the period from when the screensaver is activated until the screen becomes solid black, ie (Standby After
- Blank After
), otherwise a demo program may run over time and cause the screen section to crash
Similar to Off After
, the Suspend After
parameter usually doesn't work on laptops. On the contrary, it may trigger screensaver unexpectedly. Set it to its maximum value, which is 1440.
Automatically starting xscreensaver using desktop file
Another way to start automatically xscreensaver is to use a desktop file instead of the xscreensaver service. This approach is appropriate for XFCE because XFCE is an XScreenSaver-aware desktop environment and it needs to manage xscreensaver in its session.
To use the desktop file, create the file xscreensaver.desktop
in the directory /etc/xdg/autostart, as the root
user:
cat > /etc/xdg/autostart/xscreensaver.desktop << "EOF"
[Desktop Entry]
Type=Application
Name=Screensaver
Comment=Launch screensaver and locker program
Icon=preferences-desktop-screensaver
Exec=xscreensaver -no-splash
TryExec=xscreensaver
OnlyShowIn=KDE;GNOME;XFCE;
X-GNOME-Autostart-Notify=false
X-KDE-StartupNotify=false
EOF
xscreensaver.service or xscreensaver.desktop?
Which one to use depends on your preference. If you are not interested in controlling how xscreensaver operates and want it to run safely during a desktop environment session, use the desktop file.
If you want to control xscreensaver running, stopping, even disabling automatic startup without affecting other users, and want screensaver and screen locking activities to be performed exactly, use the systemd service.
So how is the "safety" different?
The difference is mostly at startup time (when logging into the desktop environment). If you run xscreensaver from the desktop file, the desktop environment is ready to run it at the appropriate time.
If you run xscreensaver from the systemd service, in case you set Blank After
to be too small, the screensaver will be activated too soon, leading to the creation of the root window and drawing operation of the demo program may fail.
However, this can be easily overcome by increasing the service's waiting time to restart, for example RestartSec=3min
.
Omarine uses the service by default.
Using XScreenSaver in conjunction with the desktop environment's Power Manager program
Because we have xscreensaver-systemd
, before the system goes to sleep it immediately locks the screen. At this point the screensaver is activated as if the user has not touched the mouse or keyboard until Blank After
. However, Lock Screen After
is ignored and the screen is locked immediately. No demo program is run and the screen is turned off.
When the system wakes up, the screensaver is deactivated as if there's user activity. The password dialog will pop up for the user to unlock.
We apply that to the situation of closing the laptop lid, the system goes to sleep and the screen is locked by XScreenSaver, in XFCE.
Go to Applications → Settings → Power Manager
menu. In the Plugged in
section, select Suspend
, and then click Close
Close your laptop lid and enjoy.
Share on Twitter Share on Facebook Share on Linked In
Contact: tuyen@omarine.org
Comments
There are currently no comments
New Comment