I'm running xscreensaver with LXDE on a Thinkpad X220. I ran xscreensaver-demo to set properties, including locking the screen immediately when the screensaver starts. I also wanted screen lock after suspend, so I added a systemd service file as suggested by the wiki:
$ cat /etc/systemd/system/xscreensaver.service [Unit] Description=Lock X session using xscreensaver Before=sleep.target [Service] Type=oneshot ExecStart=/usr/bin/xuserrun /usr/bin/xscreensaver-command -lock [Install] WantedBy=sleep.target
If I close the lid, wait for the machine to sleep, and then reopen the lid, xscreensaver triggers and I have to unlock the screen. This is what I want - great. But if I leave the lid closed longer than the screensaver timeout (currently at five minutes), after I log in xscreensaver is immediately relaunched and I have to log in a second time. I have not been able to find other reports of this happening. Does anyone know how I might get rid of the second login?
Here is most of my xscreensaver config (I removed the program list):
$ cat ~/.xscreensaver # XScreenSaver Preferences File # Written by xscreensaver-demo 5.21 for bree on Wed Mar 20 13:38:05 2013. # http://www.jwz.org/xscreensaver/ timeout: 0:05:00 cycle: 0:05:00 lock: True lockTimeout: 0:00:00 passwdTimeout: 0:00:30 visualID: default installColormap: True verbose: True timestamp: True splash: False splashDuration: 0:00:05 demoCommand: xscreensaver-demo prefsCommand: xscreensaver-demo -prefs nice: 10 memoryLimit: 0 fade: True unfade: False fadeSeconds: 0:00:03 fadeTicks: 20 captureStderr: True ignoreUninstalledPrograms:False font: *-medium-r-*-140-*-m-* dpmsEnabled: True dpmsQuickOff: False dpmsStandby: 0:10:00 dpmsSuspend: 0:15:00 dpmsOff: 0:20:00 grabDesktopImages: True grabVideoFrames: False chooseRandomImages: False imageDirectory: mode: random selected: -1 textMode: file textLiteral: XScreenSaver textFile: textProgram: fortune textURL: http://en.wikipedia.org/w/index.php?title=Special:NewPages&feed=rss programs: \ <snip> pointerPollTime: 0:00:05 pointerHysteresis: 10 windowCreationTimeout:0:00:30 initialDelay: 0:00:00 GetViewPortIsFullOfLies:False procInterrupts: True xinputExtensionDev: False overlayStderr: True
EDIT: If I wait several seconds after typing my password before hitting enter, then I only get one login. Some kind of race condition...?
Last edited by breecummins (2013-03-20 22:54:29)
Maybe your machine is actually trying to suspend twice? This seems like a symptom of having logind as well as acpid handle suspend (or any other combination of two things handling suspend).
If you disable this service, does the machine wake then sleep again?
I checked and I don't have acpid running on my laptop. I checked systemctl list-units, and I didn't see any other possibilities for power management (except maybe slim.service?). But I'm not sure what else would control suspend aside from logind.
In any case, it doesn't look to me like the machine is trying to suspend again - it looks like a second call to xscreensaver. If I try logging in shortly after suspend, I don't get a second login screen. It only happens after sufficient time passes that the screensaver would have blanked the screen had the machine been awake. And if I wait about 5-6 seconds before hitting enter, the second login screen doesn't occur even when the laptop has been suspended a long time. My guess is that there's a communication lag between systemd and the x server.
At any rate, it was annoying enough that I decided I don't really need a screensaver on a laptop and I switched to slimlock to lock the screen post-suspend.