Now I have two scripts and I want to execute them respectively when I close the laptop lip and open it. How can I do this?
Asked
Active
Viewed 4,101 times
1 Answers
2
Use acpi:
The event is handled by acpi:
$ sudo nano /etc/acpi/handler.sh
I did something like this:
button/lid)
case "$3" in
close)
logger 'LID closed'
USER=$(ps -C i3 -o user=)
if test $USER; then DISPLAY=:0.0 su $USER -c "/usr/bin/i3lock -i /usr/share/pixmaps/Screensaver.png"; fi
;;
Automatically starts i3lock when i close my lid.

Arch User
- 69
- 1
- 4
less /usr/share/doc/pm-utils/*
– waltinator Aug 17 '15 at 18:11