added program mute toggle.

This commit is contained in:
Crony Akatsuki 2022-08-01 17:52:05 +02:00
parent 98b8616151
commit 8cd3230470

View File

@ -2,6 +2,7 @@
source $HOME/.config/dmenu/config
portMan () {
notAvailable=$(pactl list sinks | grep 'analog-output-headphones' | grep 'not available')
[ ! -z "$notAvailable" ] && quick-notify "Port Master" "Only one port available" && exit
@ -11,5 +12,22 @@ current=$(pactl list sinks | grep 'Active Port' | awk '{ print $3 }')
case "$(printf "Speakers\\nHeadphones" | $DMENU -p "Current: $current ")" in
"Speakers") pactl set-sink-port 0 analog-output-speaker ;;
"Headphones") pactl set-sink-port 0 analog-output-headphones ;;
esac
}
programVolToggle () {
inputSinks=$(pactl list sink-inputs | sed -e 's/^[ \t]*//' | awk '/^Sink Input/{sink=$3} /^application.name/{name=$3; print name, sink}' )
[ -z "$inputSinks" ] && quick-notify "Program Master" "No Programs Inputing Sound" && exit
programSink=$(printf '%s' $inputSinks | dmenu -l 5 -p "Toggle volume: " | awk '{ print $2 }' | sed 's/#//')
pactl set-sink-input-mute $programSink toggle
}
case "$(printf "port\\nprogram" | $DMENU -p "Sound Control: ")" in
port) portMan ;;
program) programVolToggle ;;
*) exit ;;
esac