To run a script when lid state changed, the file "/etc/acpi/events/lm_lid" content should be like below:
event=button/lid.*
action=/media/data/Belgelerim/PROJE/bash/mb/lid.sh
-------------------
Get lid status:
lidstate=$(grep -oP "state:\s+\K.*" /proc/acpi/button/lid/LID/state) ;
[ "$lidstate" != "closed" ] && return;
[ "$lidstate" != "open" ] && return;
Do nothing when the laptop lid closed
- sudo nano /etc/systemd/logind.conf
HandleLidSwitch=ignore
Set the value and reload the settings.
- sudo systemctl restart systemd-logind
https://bbs.archlinux.org/viewtopic.php?id=195300
https://unix.stackexchange.com/questions/52643/how-to-disable-auto-suspend-when-i-close-laptop-lid