Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to identify the name of which screensaver was last playing an xscreensaver session? Is there a log or of which screensaver played last in xscreensaver, in a scriptfile or on the system somewhere? If, for example, you have it set to cycle or random?

share|improve this question
add comment

1 Answer 1

Indeed, there is a way to show this information via a log, and it is usually used for debugging purposes. Your user session, whether it is Gnome or Xfce, will usually auto-load xscreensaver with the options xscreensaver -no-splash &, as it does in Xfce, for example, using the file /etc/xdg/xfce4/xinitrc.

Temporary Setting

So if you want to load up xscreensaver with different options just for that session (until you log out), you can kill any running instances with

killall xscreensaver 

and then launch it with the appropriate new parameters:

xscreensaver -verbose -no-splash -log /home/$USER/xscreen2.log &

This command launches the xscreensaver daemon process with the verbose option so that it reports on exactly what it does, which is then saved in the specified log.

For this experiment, run xscreensaver-demo to set the screensaver options to random, and choose very low 'blank after' and 'cycle after' values in the settings. Now when the timeout you specified is reached, xscreensaver will start and write to the log. (The settings changed by xscreensaver-demo are saved in ~/.xscreensaver.)

More 'permanent' setting (example used is for Xfce)

If you want xscreensaver to always save its data to a log (passwords used to unlock screens are not copied to the log), first copy xfce4's systemwide xinitrc to your home folder:

cp /etc/xdg/xfce4/xinitrc $HOME/.config/xfce4/xinitrc

Now change the two occurences of

xscreensaver -no-splash &

at around lines 199 and 208 (in my version) to

xscreensaver -verbose -no-splash -log /home/$USER/xscreen1.log &

If you want to revert to the default setting, just change the commands back in the file or delete $HOME/.config/xfce4/xinitrc so that no custom xfce4 xinitrc settings are applied on login.

(You will have to logout and login for this setting to take effect)

A sample of the log created contains just what you were looking for: a way of identifying which screensavers were playing in a random session (I have shortened the log as it is extremely verbose)

xscreensaver 5.15, copyright (c) 1991-2008 by Jamie Zawinski <jwz@jwz.org>.
xscreensaver: 00:55:14: 0: spawning "glschool -root" in pid 8392.
xscreensaver: 00:56:14: 0: killing pid 8392 (glschool)
xscreensaver: 00:56:14: 0: visual 0x21 (TrueColor,   depth: 24, cmap: 256)
xscreensaver: 00:56:14: 0: saver window is 0x2e0000c.
xscreensaver: 00:56:14: 0: destroyed old saver window 0x2e00009.
xscreensaver: 00:56:14: 0: spawning "glmatrix -root" in pid 8393.
xscreensaver: 00:56:14: 0: child pid 8392 (glschool) terminated with signal 15.
xscreensaver: 00:57:14: 0: killing pid 8393 (glmatrix)
xscreensaver: 00:57:14: 0: visual 0x21 (TrueColor,   depth: 24, cmap: 256)
xscreensaver: 00:57:14: 0: saver window is 0x2e0000f.
xscreensaver: 00:57:14: 0: destroyed old saver window 0x2e0000c.
xscreensaver: 00:57:14: 0: child pid 8393 (glmatrix) terminated with signal 15.
xscreensaver: 00:57:14: 0: spawning "fiberlamp -root" in pid 8395.
xscreensaver: 00:58:14: 0: killing pid 8395 (fiberlamp)
xscreensaver: 00:58:14: 0: child pid 8395 (fiberlamp) terminated with signal 15.
xscreensaver: 00:58:14: 0: visual 0x21 (TrueColor,   depth: 24, cmap: 256)
xscreensaver: 00:58:14: 0: saver window is 0x2e00012.
xscreensaver: 00:58:14: 0: destroyed old saver window 0x2e0000f.
xscreensaver: 00:58:14: 0: spawning "fuzzyflakes -root" in pid 8396.

For more information, see man xscreensaver, man xscreensaver-demo, and the Ubuntu manpages online.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.