2016-11-04 17:50:03 -07:00
|
|
|
#!/usr/bin/env dash
|
2016-10-19 07:56:37 -07:00
|
|
|
|
2016-11-02 16:58:47 -07:00
|
|
|
# I expect all volume adjustments to be done through the volume.sh script (in
|
|
|
|
# os/arch/bin), which will inform lemonbar of changes, so we only need to intialize
|
|
|
|
# volume once here.
|
2016-10-31 19:07:23 -07:00
|
|
|
|
2016-11-06 16:40:02 -08:00
|
|
|
. $(dirname $0)/../panel-config
|
|
|
|
|
|
|
|
# media player icons
|
|
|
|
ICON_MUTED=""
|
|
|
|
ICON_SPEAKER=""
|
|
|
|
|
2016-10-31 19:07:23 -07:00
|
|
|
if echo "$data" | grep '\[on\]' >/dev/null
|
|
|
|
then
|
|
|
|
vol=$(echo "$data" | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq)
|
2016-11-06 16:40:02 -08:00
|
|
|
case "$vol" in
|
|
|
|
0) echo "V${ICON_MUTED}"
|
|
|
|
;;
|
|
|
|
*) echo "V${ICON_SPEAKER}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
echo "V%{F${COLOR_DIM}}${ICON_MUTED}%{F-}"
|
2016-10-31 19:07:23 -07:00
|
|
|
fi
|