34 lines
1.1 KiB
Bash
Executable File
34 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
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
|
|
|
|
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 ;;
|
|
|
|
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\n' "$inputSinks" | dmenu -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
|