How to Lock my laptop when I close the lid? (Solved)

versatile 64-bit multi-user Linux distribution

Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators

Post Reply
User avatar
m1k3
Posts: 86
Joined: Sat Sep 26, 2020 1:44 am
Has thanked: 33 times
Been thanked: 11 times

How to Lock my laptop when I close the lid? (Solved)

Post by m1k3 »

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.
jamesbond
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?

Post by jamesbond »

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

Code: Select all

export DISPLAY=:0
/usr/local/bin/xlock-gui -locknow
user1111

Re: How to Lock my laptop when I close the lid?

Post by user1111 »

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
User avatar
m1k3
Posts: 86
Joined: Sat Sep 26, 2020 1:44 am
Has thanked: 33 times
Been thanked: 11 times

Re: How to Lock my laptop when I close the lid?

Post by m1k3 »

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.

:thumbup:
Post Reply

Return to “FatDog64”