herbstluftwm: panel: add battery information
This commit is contained in:
parent
dc18815467
commit
36a56026a1
1 changed files with 20 additions and 1 deletions
|
|
@ -83,6 +83,25 @@ function cpu() {
|
|||
echo -n $(icon temp yellow) ${cpu}
|
||||
}
|
||||
|
||||
# BATTERY
|
||||
function battery() {
|
||||
if [ "$HOSTNAME" != warthog ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
status=$(acpi -a | cut -d':' -f2)
|
||||
battery=$(acpi -b | cut -d, -f2 | sed -e 's/[^0-9]//g')
|
||||
if [[ $status == " on-line" ]]; then
|
||||
echo -n $(icon ac2 brightblue) ${battery}%
|
||||
elif [[ $battery -le 20 ]]; then
|
||||
echo -n $(icon battery_horz1 red) ${battery}%
|
||||
elif [[ $battery -le 65 ]]; then
|
||||
echo -n $(icon battery_horz2 yellow) ${battery}%
|
||||
else
|
||||
echo -n $(icon battery_horz3 green) ${battery}%
|
||||
fi
|
||||
}
|
||||
|
||||
hc pad $monitor $panel_height
|
||||
|
||||
{
|
||||
|
|
@ -151,7 +170,7 @@ hc pad $monitor $panel_height
|
|||
right=""
|
||||
|
||||
# custom functions
|
||||
for func in cpu; do
|
||||
for func in cpu battery; do
|
||||
right="${right} $(${func})"
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue