1

merged with bb

This commit is contained in:
eleksir
2019-03-15 15:29:10 +03:00
2 changed files with 4 additions and 2 deletions

View File

@@ -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%"`;