This page describes the use-cases for user switching, session locking and power management. A describtion of these use-cases is given using xflock + xfpm + light-locker + lightdm. This page should help understand what is happening in which cases and what alternative there are to improve the situation.
The user wants to lock his session, so he can leave his desk unattended.
The session should be locked immediately and the user expects a lock screen as confirmation the screen is locked.
xflock calls lightdm lock. A new VT is spawn with the lock screen. De session lock signal is emitted and light-locker protects the session content for showing on the previous VT.
Depending on the gfx driver. If the user switches VT manually it is possible the content of the locked session is shown before light-locker is show. The gfx driver buffers the last image before the VT switch.
xflock calls light-locker lock. light-locker will setup the lockscreen before it call lightdm to lock the session.
light-locker adds a 1 sec timeout before calling lightdm lock. This should be enough to setup the session protection and this image will now be buffered by the gfx driver.
Another user wants to login without ending the current session.
The greeter for the new session should be shown immediately.
calls lightdm switch-to-greeter. A new VT is spawn with the greeter. De session lock signal is emitted and light-locker protects the session content for showing on the previous VT.
Depending on the gfx driver. If the user switches VT manually it is possible the content of the locked session is shown before light-locker is show. The gfx driver buffers the last image before the VT switch.
xflock calls light-locker lock. light-locker will setup the lockscreen before it call lightdm to lock the session.
The lock screen is the same as the greeter. Only for the lock screen the username is already inserted. light-locker adds a 1 sec timeout before calling lightdm lock. This should be enough to setup the session protection and this image will now be buffered by the gfx driver.
The use wants to save power or for any other reason switch to the screensaver.
This can be done with xdg-screensaver, xset, light-locker-command.
light-locker will see this as the start of the idle time. And it will start the lock after screensaver timer.
The user wants to suspend/hibernate the computer.
Assumming he wants his session to be locked on resume.
This can be done wich a susspend key, xfsm, xfpm, init call. The init system will emit the suspend signal. light-locker will prepare the session protection on suspend by hiding the content.
On resume the resume signal is emitted. light-locker will call lightdm lock to lock the session. This is done after a short delay to give the current X session some time to restore the gfx. After the lock call the VT is switched to the lock screen.
The user leaves the session idle. To protect his session in this case the session should be locked after some time.
The user expects the screen to be blank the whole time (screensaver) and the lock screen to be presented when the screensaver is stopped.
light-locker will start a timer after the screensaver starts. When this timer ends it will call lightdm lock and switch to the lock screen.
To prevent the lockscreen from showing the screensaver needs to be active in the new VT as well. This contradicts other lightdm lock calls.
light-locker will start a timer after the screensaver starts. When this timer ends the session protection is started. When the screensaver it stopped light-locker will call lightdm lock. Switching the session to the lock sreen.
This will add some delay before the session can be unlocked.
The user wants his session locked directly when the lid of the computer is closed. When the lid is opened the lock screen should be shown.
xfpm calls lightdm lock. A new VT is spawn with the greeter. De session lock signal is emitted and light-locker protects the session content for showing on the previous VT.
Depending on the gfx driver. If the user switches VT manually it is possible the content of the locked session is shown before light-locker is show. The gfx driver buffers the last image before the VT switch.
Depending on the gfx driver/hardware. The backlight won't be turned back on when the session is unlocked.
xfpm needs to inhibit the init system not to perform its own actions. It is reported that switching to the lock screen will still activate the init system.
xfpm calls light-locker lock. light-locker will setup the lockscreen before it call lightdm to lock the session. light-locker adds a 1 sec timeout before calling lightdm lock. This should be enough to setup the session protection and this image will now be buffered by the gfx driver.
(Is this true for locking as well?) Depending on the gfx driver. The backlight won't be turned back on when the session is unlocked.
xfpm needs to inhibit the init system not to perform its own actions. It is reported that switching to the lock screen will still activate the init system.
xfpm calls light-locker lock. light-locker will setup the session protection. When the screensaver it stopped (on lid open. Does that happen?) light-locker will call lightdm lock (A delay might be required for the backlight to restore). Switching the session to the lock sreen.
This contradicts other light-locker lock calls.
The user wants his computer suspended when the lid is closed. When the lid is opened the lock screen should be shown.
xfpm calls init system suspennd. The init system will emit the suspend signal. light-locker will prepare the session protection on suspend by hiding the content.
On resume the resume signal is emitted. light-locker will call lightdm lock to lock the session. This is done after a short delay to give the current X session some time to restore the gfx. After the lock call the VT is switched to the lock screen.
This was not reported: Depending on the gfx driver/hardware. The backlight won't be turned back on when the session is unlocked. (maybe more delay will solve this)