Files
dots/files/scripts/dwm_bar/volume.sh
2021-03-27 01:17:39 +01:00

19 lines
509 B
Bash
Executable File

#!/bin/sh
SINK=$(pactl list short sinks | grep -n RUNNING | cut -d":" -f1)
if [ "$SINK" = "" ]; then
SINK=1
fi
NOW=$( pactl list sinks | grep '^[[:space:]]Volume:' | head -n $SINK | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' )
MUTE=$(pactl list sinks | grep '^[[:space:]]Mute:'| head -n $SINK | tail -n 1 | awk -F ":" '{print $2}'| xargs)
if [ "$MUTE" = "yes" ]; then
echo "Muted"
else
echo "$NOW%"
fi
case $BLOCK_BUTTON in
1) setsid -f st -c stpulse -n stpulse -e ncpamixer ;;
esac