Improved lock screen support
Created by: thatguystone
I'm looking for some feedback and ideas about the current state of lock screens under wlroots.
Right now, it looks like lock screens are implemented the same way they were under X11, specifically: fullscreen window on top of everything else and input inhibit. While this works, it has a number of problems, and I'm hoping that it can be improved on.
Problems
-
If anything causes the lock screen process to exit, the screen becomes unlocked. This issue continues to pop up (eg. xscreensaver, swaylock), and likely can't be solved (thanks, oomk) without compositor support.
-
Programs can unintentionally end up on the lock screen. Programs that want to end up on the lock screen have no way to ensure they do.
-
Race conditions: when resuming from sleep or messing with dpms, the desktop sometimes shows briefly before the lock screen does.
Protocol design goals
-
Provide a mechanism to request the compositor "lock" / "unlock". The lock state should persist even if the requesting client dies.
-
Provide clients with lock screen state:
enum {UNLOCKED,LOCKING,LOCKED,UNLOCKING}
-
UNLOCKED
: the unlocked desktop is visible -
LOCKING
: the compositor has received a LOCK request, but the unlocked desktop is still visible -
LOCKED
: the unlocked desktop is not visible -
UNLOCKING
: the locked desktop is still visible
-
-
Allow clients to configure which surfaces are visible when locked and unlocked. By default, surfaces are only visible when unlocked.
Client usage
-
A wallpaper process could display different images when locked / unlocked (similar to how Android and iOS do it).
-
A volume/brightness OSD could ensure it appears when locked and unlocked.
-
A notification daemon might want to hide notification content and only display icons with numbers next to them when locked.
-
A panel could hide all workspace buttons/menus/trays but continue to show current time.
-
A lock screen process (eg. swaylock --daemonize) could wait for a
LOCKED
event, ensuring that the desktop is not visible once the parent exits.
Implementation
I haven't worked much with wayland, but here's what I'm thinking, and I'd appreciate any feedback.
This should probably be a new protocol. It looks like it would fit nicely into layer_shell, but with kwin implementing layer_shell, I doubt it would be a good idea to force a lockscreen on them since they already handle locking their own way.
I'm not entirely sure of the best way to communicate to clients which surfaces the compositor is capable of rendering on a lock screen.