updated battery status

This commit is contained in:
Solomon Laing 2022-05-11 19:49:52 +09:30
parent 62b2816bfd
commit 72367bb2b2
2 changed files with 20 additions and 2 deletions

View File

@ -3,7 +3,7 @@
icon=""
current=$(acpi --battery | sed -e 's/%.*//' | sed 's/.*, //')
status="$current%"
state=$(acpi --battery | sed -e 's/,.*//' | sed 's/.*: //')
if [[ "$state" == "Discharging" ]]; then
@ -30,4 +30,13 @@ if [[ "$state" == "Not charging" ]]; then
icon=""
fi
echo "$icon $current%"
if [[ "$state" == "Full" ]]; then
icon=""
status="Full"
fi
if [[ "$state" == "Charging" ]]; then
icon=""
fi
echo "$icon $status"

9
scripts/xmobar-status-bat Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
# a simple wrapper for inserting xmobar stuff
status=$(status-bat)
parts=($status)
echo "<fn=1>${parts[0]}</fn> ${parts[1]}"