Update battery icon promptly on power changes
This commit is contained in:
@@ -2,8 +2,13 @@
|
||||
|
||||
# omarchy:summary=Returns true if external power is connected.
|
||||
|
||||
for ac in /sys/class/power_supply/AC* /sys/class/power_supply/ADP*; do
|
||||
[[ -r $ac/online && $(cat "$ac/online") == "1" ]] && exit 0
|
||||
power_supply_path="${OMARCHY_POWER_SUPPLY_PATH:-/sys/class/power_supply}"
|
||||
|
||||
for supply in "$power_supply_path"/*; do
|
||||
[[ -r $supply/online && -r $supply/type ]] || continue
|
||||
type=$(<"$supply/type")
|
||||
[[ $type == "Mains" || $type == "USB" ]] || continue
|
||||
[[ $(<"$supply/online") == "1" ]] && exit 0
|
||||
done
|
||||
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user