the-cavalry / light-locker

A simple session-locker for lightdm
GNU General Public License v2.0
224 stars 22 forks source link

When lightdm's own xscreensaver unblanks, light-locker prevents the greeter from re-appearing #81

Open infinity0 opened 8 years ago

infinity0 commented 8 years ago

I'm trying to configure lightdm to run xscreensaver within the greeter, so that I can have the benefit of light-locker's more secure locking method but with xscreensaver's nice-looking hacks. I've managed to get everything working, except that when I:

  1. run light-locker-command -l
  2. in the new greeter, wait for xscreensaver to activate
  3. move the mouse to deactivate it

then the lightdm greeter turns into a black screen with the mouse pointer visible, and I can't log back into my light-locked session. I'm pretty sure this is a light-locker issue, e.g. everything works if I:

a. in the initial greeter after system startup, do (2) and (3) b. log in, log out, and repeat (2) and (3)

For reference, here is my configuration, on a Debian system where lightdm runs as the user lightdm and puts run-time stuff in /var/run/lightdm:

/etc/lightdm/lightdm.conf, snippet:

greeter-setup-script=/etc/lightdm/greeter-setup-script
session-setup-script=/etc/lightdm/session-setup-script

/etc/lightdm/greeter-setup-script:

#!/bin/sh
set -e
/etc/lightdm/session-setup-script

rundir="/var/run/lightdm/xscreensaver-$DISPLAY"
mkdir -p "$rundir"
chown lightdm:lightdm "$rundir"

cp "$XAUTHORITY" "$rundir/.Xauthority"
chown lightdm:lightdm "$rundir/.Xauthority"
export XAUTHORITY="$rundir/.Xauthority"

su -c "nohup xscreensaver -nosplash -display '$DISPLAY' -log '$rundir/xscreensaver.log' -verbose -no-capture-stderr >/dev/null &" lightdm

/etc/lightdm/session-setup-script:

#!/bin/sh
set -e
rundir="/var/run/lightdm/xscreensaver-$DISPLAY"
if xscreensaver-command -display "$DISPLAY" -exit; then
    test -f "$rundir/.Xauthority" && rm -rf "$rundir" || true
fi

Before testing this, one should configure lightdm's xscreensaver by doing something like this:

$ xauth list
<your cookies>
$ sudo chsh -s /bin/sh lightdm
$ sudo su - lightdm
lightdm$ export XAUTHORITY=$HOME/.Xauthority
lightdm$ xauth add <your cookies>
lightdm$ xscreensaver-demo
ochosi commented 8 years ago

First question, why are you running xscreensaver in the lightdm greeter?

My guess would have been that you either want xscreensaver in your session (so un/locking never takes you to the greeter and you avoid the potential pains of VT switching) or you use light-locker and then X11's built-in screensaver to just blank the screen (or use X11's DPM to power off the screen after a timeout).

infinity0 commented 8 years ago

I was under the impression that light-locker used a more secure locking method (VT switching) than xscreensaver, so that e.g. if the process died for some reason the session would still be locked. It seems that's not the case - I unlocked my session by doing a pkill light-locker - but (I was told) that physlock can survive this and it's the whole point of VT switching. Again I could be wrong here, though.