herbstluftwm: panel: refactor battery function
This commit is contained in:
parent
69b5583821
commit
d44f2c4f90
1 changed files with 5 additions and 4 deletions
|
|
@ -97,14 +97,15 @@ function battery() {
|
||||||
status=$(acpi -a | cut -d':' -f2)
|
status=$(acpi -a | cut -d':' -f2)
|
||||||
battery=$(acpi -b | cut -d, -f2 | sed -e 's/[^0-9]//g')
|
battery=$(acpi -b | cut -d, -f2 | sed -e 's/[^0-9]//g')
|
||||||
if [[ $status == " on-line" ]]; then
|
if [[ $status == " on-line" ]]; then
|
||||||
echo -n $(icon ac2 brightmagenta) ${battery}%
|
echo -n $(icon ac2 brightmagenta)
|
||||||
elif [[ $battery -le 20 ]]; then
|
elif [[ $battery -le 20 ]]; then
|
||||||
echo -n $(icon battery_horz1 red) ${battery}%
|
echo -n $(icon battery_horz1 red)
|
||||||
elif [[ $battery -le 65 ]]; then
|
elif [[ $battery -le 65 ]]; then
|
||||||
echo -n $(icon battery_horz2 yellow) ${battery}%
|
echo -n $(icon battery_horz2 yellow)
|
||||||
else
|
else
|
||||||
echo -n $(icon battery_horz3 green) ${battery}%
|
echo -n $(icon battery_horz3 green)
|
||||||
fi
|
fi
|
||||||
|
echo " ${battery}%"
|
||||||
}
|
}
|
||||||
|
|
||||||
# VOLUME
|
# VOLUME
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue