Add volume script

This commit is contained in:
Marco Thomas
2021-03-26 13:30:58 +01:00
parent 59f4dd0517
commit 0c44704f90

18
files/scripts/dwm_bar/volume.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/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 "$NOW%"
else
echo "$NOW%"
fi
case $BLOCK_BUTTON in
1) setsid -f st -c stpulse -n stpulse -e ncpamixer ;;
esac