The officially official Devuan Forum!

You are not logged in.

#1 Today 18:10:02

Mercury
Member
Registered: 2024-11-14
Posts: 30  

[HowTo] Use slimlock with xfce

slimlock is included with the slim login manager. If you already have slim installed, there is no need to get another screenlocker utility. However, slimlock has one major difference to all other screenlockers: When called, it does not return with a success code until after the screen is unlocked. Other screenlockers return immediately and keep the screen locked.

If slimlock is set as the lock command in xfce4, it will not work correctly with sleep security. (Xfce Settings → Power Manager → System → Lock screen when system is going to sleep) Since xfce4 waits for the screenlocker to return before putting the system to sleep, the user sees the lock screen but the system will not sleep. Once the user unlocks the screen, then the system will go to sleep. Obviously this is not what the user wants.

Here's how to fix it.

Create the file /usr/local/bin/aslimlock.sh with these contents:

#!/bin/sh
/usr/bin/slimlock &
sleep 1
pgrep -f -x "/usr/bin/slimlock" --parent ${$} || exit 1

This script runs slimlock asynchronously, ensures that it is still running after one second, and returns a success or error code depending on the status.

Ensure this script is given execute permissions.

Now set aslimlock.sh as xfce4's lock command.

You can use the GUI: Navigate to Xfce Settings → Settings Editor → Channel: xfce4-session → Property: LockCommand; and enter /usr/local/bin/aslimlock.sh in the Value field.

Alternatively, you can use the command line:
xfconf-query --channel 'xfce4-session' --property '/general/LockCommand' --set '/usr/local/bin/aslimlock.sh'

The system will now correctly respond to a suspend request. The screen will lock and the system will enter sleep mode. On wake, the screen will be locked and awaiting a password.

Offline

Board footer