Skip to content

Xflock4

Jarno Suni requested to merge jarnos/xfce4-session:xflock4 into master

Here are my fixes and improvements to xflock4 script:

  • adds support for LockCommand that is a shell script. So even if a non-forking locker is used, it can be run in background by using '&' in the command line.

  • If there is non-null LockCommand, do not try other alternatives.

  • Provides explicit support for xfce4-screensaver, xscreensaver and light-locker. (light-locker is treated specially by xfce4-power-manager.) Drops explicit support for gnome-screensaver (that is unmaintained currently).

  • Removes hard coded fallback lockers (that is xlock and slock); users could set LockCommand, instead.

  • Adds one second delay before calling a locker, if issued from terminal to prevent possible waking up display that was supposed to be put to sleep by a locker. Note that xflock does not turn display off explicitly with any locker anymore. (#29 (closed))

  • prevents recursive calling of xflock4 (#120 (closed))

  • Exit with error, if there is no X connection

Please refer to commits for more details.

Caller of xflock4 should wait for the exit status of the script and operate accordingly. xflock4 is supposed to know the logic that decides how to lock desktop at will, so there is not need to reinvent that elsewhere like have been done: see xfce4-power-manager#51 (moved). Though I suspect that some screensavers may use systemd units for locking with e.g. suspend which may be an issue. Besides, if a screensaver is set up to lock screen after a delay of inactivity, it can handle it without xflock4.

I tested xflock4 a lot but only in GNU/Linux. Anyway I tried to make the script portable and use POSIX conventions.

Edited by Jarno Suni

Merge request reports