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