diff --git a/bin/omarchy-battery-capacity b/bin/omarchy-battery-capacity index fa4b4c03db..6a41ec38aa 100755 --- a/bin/omarchy-battery-capacity +++ b/bin/omarchy-battery-capacity @@ -3,7 +3,7 @@ # Returns the battery full capacity in Wh (rounded to whole number). # Used by omarchy-battery-status for displaying battery capacity. -battery_info=$(upower -i $(upower -e | grep BAT)) +battery_info=$(upower -i $(upower -e | grep '/battery_' | head -1)) echo "$battery_info" | awk '/energy-full:/ { printf "%d", $2 diff --git a/bin/omarchy-battery-present b/bin/omarchy-battery-present index 2b052a7aeb..60d042c89d 100755 --- a/bin/omarchy-battery-present +++ b/bin/omarchy-battery-present @@ -3,7 +3,7 @@ # Returns true if a battery is present on the system. # Used by the battery monitor and other battery-related checks. -for bat in /sys/class/power_supply/BAT*; do +for bat in /sys/class/power_supply/*; do [[ -r $bat/present ]] && [[ $(cat $bat/present) == "1" ]] && [[ $(cat $bat/type) == "Battery" ]] && diff --git a/bin/omarchy-battery-remaining b/bin/omarchy-battery-remaining index 26ea718fd1..d637bb06f4 100755 --- a/bin/omarchy-battery-remaining +++ b/bin/omarchy-battery-remaining @@ -3,7 +3,7 @@ # Returns the battery percentage remaining as an integer. # Used by the battery monitor and the Ctrl + Shift + Super + B hotkey. -upower -i $(upower -e | grep BAT) | awk '/percentage/ { +upower -i $(upower -e | grep '/battery_' | head -1) | awk '/percentage/ { print int($2) exit }' diff --git a/bin/omarchy-battery-remaining-time b/bin/omarchy-battery-remaining-time index c4f39593a6..19dc755585 100755 --- a/bin/omarchy-battery-remaining-time +++ b/bin/omarchy-battery-remaining-time @@ -2,7 +2,7 @@ # Returns the battery time remaining (to empty or full) in a compact format. -battery_info=$(upower -i $(upower -e | grep BAT)) +battery_info=$(upower -i $(upower -e | grep '/battery_' | head -1)) echo "$battery_info" | awk '/time to (empty|full)/ { value = $4 diff --git a/bin/omarchy-battery-status b/bin/omarchy-battery-status index 021c0aa498..7437b0034d 100755 --- a/bin/omarchy-battery-status +++ b/bin/omarchy-battery-status @@ -3,7 +3,7 @@ # Returns a formatted battery status string with percentage and power draw/charge. # Used by the battery notification hotkey (Ctrl + Shift + Super + B). -battery_info=$(upower -i $(upower -e | grep BAT)) +battery_info=$(upower -i $(upower -e | grep '/battery_' | head -1)) percentage=$(echo "$battery_info" | awk '/percentage/ { print int($2) diff --git a/migrations/1752168292.sh b/migrations/1752168292.sh index 0f529134ca..947c35ea1c 100644 --- a/migrations/1752168292.sh +++ b/migrations/1752168292.sh @@ -1,6 +1,6 @@ echo "Enable battery low notifications for laptops" -if ls /sys/class/power_supply/BAT* &>/dev/null && [[ ! -f ~/.local/share/omarchy/config/systemd/user/omarchy-battery-monitor.service ]]; then +if omarchy-battery-present && [[ ! -f ~/.local/share/omarchy/config/systemd/user/omarchy-battery-monitor.service ]]; then mkdir -p ~/.config/systemd/user cp ~/.local/share/omarchy/config/systemd/user/omarchy-battery-monitor.* ~/.config/systemd/user/