How to Lock my laptop when I close the lid? (Solved)
Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators
How to Lock my laptop when I close the lid? (Solved)
What's the best way to go about getting my laptop to activate xlock when I close the lid and it suspends? I thought maybe adding xlock to /etc/acpi/actions/suspend.sh would do the trick but that didn't work for me.
Last edited by m1k3 on Mon Sep 28, 2020 2:35 pm, edited 1 time in total.
-
- Posts: 717
- Joined: Tue Aug 11, 2020 3:02 pm
- Location: The Pale Blue Dot
- Has thanked: 124 times
- Been thanked: 402 times
Re: How to Lock my laptop when I close the lid?
1. Make sure you have xlock configured properly. If not you will have to hard-reboot your machine.
2. Add this as the last line in /etc/acpi/action/suspend.sh
2. Add this as the last line in /etc/acpi/action/suspend.sh
Code: Select all
export DISPLAY=:0
/usr/local/bin/xlock-gui -locknow
Re: How to Lock my laptop when I close the lid?
Beat me to it James. I was just about to suggest trying /etc/acpi/action/suspend.sh editted to have ...
Code: Select all
#suspend
su - `whoami` -c '
export DISPLAY=:0
xlock &
'
echo mem > /sys/power/state
Re: How to Lock my laptop when I close the lid?
Thank you both! I ended up going with rufwoof's implementation because for some reason xlock-gui wouldn't use the "atunnels" visualization even though I configured it. I checked .xlock-gui in the root directory just to be sure. So, I'm using xlock -mode atunnels instead.