Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/omarchy-battery-capacity
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-battery-present
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]] &&
Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-battery-remaining
Original file line number Diff line number Diff line change
Expand Up @@ -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
}'
2 changes: 1 addition & 1 deletion bin/omarchy-battery-remaining-time
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-battery-status
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion migrations/1752168292.sh
Original file line number Diff line number Diff line change
@@ -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/
Expand Down