39 lines
789 B
Bash
Executable File
39 lines
789 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Module prints out current volume, or shows 'MUTED' if muted.
|
|
# Also shows icons corresponding to volume level.
|
|
|
|
# Global config
|
|
source config
|
|
|
|
# Emoji used by module
|
|
i_max=" "
|
|
i_med=" "
|
|
i_low=" "
|
|
i_non=" "
|
|
i_mut=" "
|
|
|
|
# At which levels to trigger emoji at
|
|
max=0
|
|
med=50
|
|
low=1
|
|
|
|
# status2d patch alternating background
|
|
# background="^b#333333^"
|
|
# background="^b#222222^"
|
|
|
|
# Parse current brightness and cast to int
|
|
brightness="$(xbacklight -getf)"
|
|
brightness="${brightness%.*}"
|
|
|
|
# Set icon according to volume level
|
|
case 1 in
|
|
$(($brightness > $max)) ) icon=$i_max ;;
|
|
$(($brightness > $med)) ) icon=$i_med ;;
|
|
$(($brightness > $low)) ) icon=$i_low ;;
|
|
* ) icon=$i_non ;;
|
|
esac
|
|
|
|
# Print icon + volume (pad with 3 0s)
|
|
printf "$background$wb%s %03d%%$we^d^" $icon $brightness
|