added program mute toggle.
This commit is contained in:
parent
98b8616151
commit
8cd3230470
@ -2,14 +2,32 @@
|
||||
|
||||
source $HOME/.config/dmenu/config
|
||||
|
||||
notAvailable=$(pactl list sinks | grep 'analog-output-headphones' | grep 'not available')
|
||||
portMan () {
|
||||
notAvailable=$(pactl list sinks | grep 'analog-output-headphones' | grep 'not available')
|
||||
|
||||
[ ! -z "$notAvailable" ] && quick-notify "Port Master" "Only one port available" && exit
|
||||
[ ! -z "$notAvailable" ] && quick-notify "Port Master" "Only one port available" && exit
|
||||
|
||||
current=$(pactl list sinks | grep 'Active Port' | awk '{ print $3 }')
|
||||
[ "$current" = "analog-output-speaker" ] && current="Speakers" || current="Headphones"
|
||||
current=$(pactl list sinks | grep 'Active Port' | awk '{ print $3 }')
|
||||
[ "$current" = "analog-output-speaker" ] && current="Speakers" || current="Headphones"
|
||||
|
||||
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 ;;
|
||||
case "$(printf "Speakers\\nHeadphones" | $DMENU -p "Current: $current ")" in
|
||||
"Speakers") pactl set-sink-port 0 analog-output-speaker ;;
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user