nixos/config/dwmbar/bar.sh
2023-09-12 09:58:04 +04:00

25 lines
533 B
Bash
Executable file

#!/bin/sh
blue=#0000ff
battery() {
get_capacity="$(cat /sys/class/power_supply/BAT*/capacity)"
get_status="$(cat /sys/class/power_supply/BAT*/status)"
case "$get_status" in
Charging) printf "^c$blue^ 󰂄 $get_capacity" ;;
Discharging) printf "^c$white^ ^b$blue 󰁹 $get_capacity"
esac
}
audio() {
get_vol=$(pamixer --get-volume-human)
if [ $get_vol = 'muted' ]; then
printf "^b$blue^ 󰕾 Muted"
else
printf "^b$blue^ 󰕾 $get_vol"
fi
}
while true; do
sleep 1 && xsetroot -name "$(battery)"
done