|
12345678910111213141516171819202122232425262728293031323334 |
- #!/bin/sh
-
- speaker_muted=🔇
- speaker_low=🔈
- speaker_medium=🔉
- speaker_high=🔊
- brightness_symbol=🔅
- # Statusbar loop
- while true; do
- bat_state=$(acpi | awk 'NR==1{print $3}')
- if [ $bat_state == 'Charging,' ]; then
- bat_state='🠝'
- else
- bat_state='🠟'
- fi
-
- volume=$(amixer sget Master | awk -F"[][]" 'END{ print $2 }')
- volume_amount=$(printf $volume | tr -d %)
- if [ $volume_amount == 0 ]; then
- volume_symbol=$speaker_muted
- elif [ $volume_amount -lt 30 ]; then
- volume_symbol=$speaker_low
- elif [ $volume_amount -lt 70 ]; then
- volume_symbol=$speaker_medium
- else
- volume_symbol=$speaker_high
- fi
-
- bat_percentage=$(acpi | awk 'NR==1{print $4}' | tr -d [,])
-
- brightness=$(xbacklight -get | grep -o '^..')
- xsetroot -name "$brightness_symbol$brightness% | $volume_symbol$volume | 🔋$bat_state$bat_percentage | $(date +"%c")"
- sleep 1m # Update time every minute
- done
|