Skip to content

Commit a7e6920

Browse files
committed
account for weird acpi -b output
1 parent e0d3e0b commit a7e6920

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

configs/i3/block-scripts/battery.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/sh
22

33
warn_state_file=/tmp/.battery-warning-notification-id
4-
search='Battery 0: '
5-
full_text=$(acpi -b | grep "^$search" | cut -d: -f2-)
4+
full_text=$(acpi -b | grep -vF 'rate information unavailable' | head -1 | cut -d: -f2-)
65
status=$(echo "$full_text" | cut -d, -f1 | sed -e 's/^[[:space:]]*//')
76
pct=$(echo "$full_text" | cut -d, -f2 | sed s/%// | tr -d '[:space:]')
87
if ! echo "$full_text" | grep -qF -e 'rate information unavailable' -e 'zero rate'; then

0 commit comments

Comments
 (0)