script-linux/statusbar.sh

24 lines
752 B
Bash
Raw Normal View History

2023-12-13 17:57:35 +01:00
#!/bin/bash
2024-02-29 14:49:07 +01:00
status_bar(){
wifi=$(/usr/sbin/iwgetid -r)
date=$(date +"%a %d %b. %Y")
hour=$(date +"%H:%M")
battery=$(upower -i $(upower -e | grep BAT) | grep percentage | sed "s/ //g" | cut -d ":" -f2)
2024-12-29 20:41:03 +01:00
battery_state=$(upower -i $(upower -e | grep BAT) | grep state | sed "s/ //g" | cut -d':' -f2)
2024-02-29 14:49:07 +01:00
sound_card=$(cat ~/.config/sound_card)
volume=$(amixer get $sound_card | grep % | head -n 1 | cut -f7 -d' ' | sed "s/\[\|\]//g")
brightness=$(~/dev/script/luminosity get)
2023-12-13 18:06:01 +01:00
2024-12-29 20:41:03 +01:00
xsetroot -name "| res: $wifi | lum: $brightness | vol: $volume [$sound_card] | bat: $battery [$battery_state] | $date | $hour |"
2024-02-29 14:49:07 +01:00
}
2023-12-13 17:57:35 +01:00
2024-02-29 14:49:07 +01:00
if [[ $1 == "once" ]]; then
status_bar
else
while true; do
status_bar
sleep 15
done
fi