nixos/config/dwmbar/bar.sh

26 lines
536 B
Bash
Raw Normal View History

2023-09-12 09:09:06 +04:00
#!/bin/sh
2023-09-12 09:17:45 +04:00
blue=#0000ff
2023-09-12 09:09:06 +04:00
battery() {
2023-09-12 10:06:53 +04:00
get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)"
get_status="$(cat /sys/class/power_supply/BAT1/status)"
2023-09-12 09:09:06 +04:00
case "$get_status" in
Charging) printf "^c$blue^ 󰂄 $get_capacity" ;;
2023-09-12 10:24:00 +04:00
Discharging) printf "^c$white^ ^b$blue 󰁹 $get_capacity" ;;
2023-09-12 09:09:06 +04:00
esac
}
2023-09-12 09:17:45 +04:00
audio() {
get_vol=$(pamixer --get-volume-human)
if [ $get_vol = 'muted' ]; then
printf "^b$blue^ 󰕾 Muted"
else
printf "^b$blue^ 󰕾 $get_vol"
fi
}
2023-09-12 09:09:06 +04:00
while true; do
sleep 1 && xsetroot -name "$(battery)"
done