You are not logged in.
Pages: 1
I would like to disable suspending on lid close on AC so that my systemd backup timer would work. However, I also want to enable suspending on battery.
I set the "HandleLidSwitch" in /etc/systemd/logind.conf to "ignore"
However, I would not be able to suspend on lid close when I am using my battery, which will drain the battery very quickly.
I am using GNOME 3 with gdm.
Offline
Isn't that available in gnome-settings /powermanager or something like that?
Arch is home!
https://github.com/Docbroke
Offline
Isn't that available in gnome-settings /powermanager or something like that?
No. Systemd is managing those events now. Therefore, I would prefer to add a script to run before suspending that detects whether the computer is plugged in.
Offline
Something like this
#!/bin/bash
xlock() {
( slock && xset dpms 0 0 300 ) &
xset dpms 0 0 2
xset dpms force off
}
while true;
do
if [[ $(< /proc/acpi/button/lid/LID0/state) = *closed ]]
then
case $(< /sys/class/power_supply/AC/online) in
1) [[ ! "$(pidof slock)" ]] && xlock ;;
0) systemctl suspend ;;
esac
fi
sleep 2;
done
Last edited by Docbroke (2017-04-05 03:20:03)
Arch is home!
https://github.com/Docbroke
Offline
Something like this
#!/bin/bash xlock() { ( slock && xset dpms 0 0 300 ) & xset dpms 0 0 2 xset dpms force off } while true; do if [[ $(< /proc/acpi/button/lid/LID0/state) = *closed ]] then case $(< /sys/class/power_supply/AC/online) in 1) [[ ! "$(pidof slock)" ]] && xlock ;; 0) systemctl suspend ;; esac fi sleep 2; done
Sorry for late reply. Where should I put this file?
Offline
Pages: 1