acpid.pl: do not try to hibernate on low battery if it being charging
This commit is contained in:
6
acpid.pl
6
acpid.pl
@@ -109,8 +109,10 @@ while ( sleep(180) ) {
|
|||||||
chomp($buf); # just in case
|
chomp($buf); # just in case
|
||||||
|
|
||||||
if ($buf < $MIN_CHARGE) {
|
if ($buf < $MIN_CHARGE) {
|
||||||
logger("Battery charge is less than 10%, hibernating\n");
|
if ($charging != 0) { # discharging
|
||||||
`dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate`;
|
logger("Battery charge is less than 10%, hibernating\n");
|
||||||
|
`dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate`;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($buf < ($MIN_CHARGE + 5)) {
|
if ($buf < ($MIN_CHARGE + 5)) {
|
||||||
`notify-send --urgency=critical --expire-time=10000 --icon=battery-caution "Low battery charge: $buf%"`;
|
`notify-send --urgency=critical --expire-time=10000 --icon=battery-caution "Low battery charge: $buf%"`;
|
||||||
|
|||||||
Reference in New Issue
Block a user