elogind and lock before suspend
by Tonus from LinuxQuestions.org on (#5C87S)
Hi all,
Running no power management tool with my WM and was looking for transition from pm-* commands to new elogind ones.
To lock before suspend, elogind uses scripts in /lib{,64}/elogind/system-sleep/
To auto-lock, a simple script like this should do the trick (single user board here, thank you for improvements if you know some)
Code:username=<YOUR_USERNAME>
userhome=/home/$username
export XAUTHORITY="$userhome/.Xauthority"
export DISPLAY=":0"
/usr/bin/xautolock -locknow &
sleep 1s;I will look for more universal way since telling the username varaiable isn't very reliable...


Running no power management tool with my WM and was looking for transition from pm-* commands to new elogind ones.
To lock before suspend, elogind uses scripts in /lib{,64}/elogind/system-sleep/
To auto-lock, a simple script like this should do the trick (single user board here, thank you for improvements if you know some)
Code:username=<YOUR_USERNAME>
userhome=/home/$username
export XAUTHORITY="$userhome/.Xauthority"
export DISPLAY=":0"
/usr/bin/xautolock -locknow &
sleep 1s;I will look for more universal way since telling the username varaiable isn't very reliable...