mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Fix: Low Battery notification returning empty value on reboot (#2949)
* Fix: Low Battery notification returning empty value on reboot * Simplify the check * Double paste --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
@@ -11,11 +11,13 @@ send_notification() {
|
|||||||
notify-send -u critical " Time to recharge!" "Battery is down to ${1}%" -i battery-caution -t 30000
|
notify-send -u critical " Time to recharge!" "Battery is down to ${1}%" -i battery-caution -t 30000
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $BATTERY_STATE == "discharging" && $BATTERY_LEVEL -le $BATTERY_THRESHOLD ]]; then
|
if [[ -n "$BATTERY_LEVEL" && "$BATTERY_LEVEL" =~ ^[0-9]+$ ]]; then
|
||||||
if [[ ! -f $NOTIFICATION_FLAG ]]; then
|
if [[ $BATTERY_STATE == "discharging" && $BATTERY_LEVEL -le $BATTERY_THRESHOLD ]]; then
|
||||||
send_notification $BATTERY_LEVEL
|
if [[ ! -f $NOTIFICATION_FLAG ]]; then
|
||||||
touch $NOTIFICATION_FLAG
|
send_notification $BATTERY_LEVEL
|
||||||
|
touch $NOTIFICATION_FLAG
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -f $NOTIFICATION_FLAG
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
rm -f $NOTIFICATION_FLAG
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user