Xfce Forum

Sub domains

You are not logged in.

#1 2021-04-10 13:48:35

From: Finland
Registered: 2009-03-22
Posts: 28

Better xflock4


I have been working on improving xflock4 script that locks desktop. It can be used in command line and it may be used by session manager and power manager, but the logic is currently fuzzy. Also Action Buttons panel applet uses it for Lock Screen command at least and there are keyboard shortcuts for the script. The current script already supports Xfconf property LockCommand in xfce4-session channel, but my script adds more properties by which you can adjust the operation of the script especially when using LockCommand. If you use the current script when LockCommand is assigned with e.g. "slock" - a command that runs in foreground i.e. it does not fork - then the script does not exit before you unlock. That is undesirable, if you use xflock4 to lock desktop before suspending and you want to check that locking succeeded before that by using script 'xflock4 && xfce4-session-logout --suspend' in shell. You can configure the new script to work with that kind of lockers, too. The script is supposed to exit with non-zero exit status, if locking fails. Also there are better options for display power management signaling (DPMS) with LockCommand especially, if the command does not fork. The script recognizes new screensavers and supports even unknown screensavers by calling 'xdg-screensaver lock' as fallback (if your system has the command. Don't they all?)

I made a git branch that focuses on the script and its usage. You can find the script here.

In order to configure the operation of the script you can use Settings Editor to add/modify xfce4-session channel's Xfconf properties that are supported by this variation of xflock4.

You can find detailed information about the properties in these commit messages:
https://gitlab.xfce.org/jarnos/xfce4-se … 01823003d2
https://gitlab.xfce.org/jarnos/xfce4-se … 896a36d610
Complete list of the commits can be found at
https://gitlab.xfce.org/jarnos/xfce4-se … ts/xflock4

I have also made a merge request in xfce4-session about these changes:
https://gitlab.xfce.org/xfce/xfce4-sess … equests/20

I encourage you to try and test it in different platforms. Feedback is welcome and please tell me, if you find some issues with the script.

You can test and use the modified xflock4 script even if you are using an older release of Xfce. Just copy the script in your machine by name xflock4, make it executable (by 'chmod -x') and put it in a suitable directory listed in PATH so that it is found earlier than the script that comes with your Xfce release. (You may run 'command -v xflock4' to find its directory. For example in Xubuntu you can use /usr/local/bin so that the modified script is used instead of the one found in /usr/bin.)

P.S. If you are using XScreenSaver, you may be interested in this post.


Board footer

Powered by FluxBB