dmenu-scripts/dmenu-pulse-port-man

14 lines
562 B
Bash
Executable File

#!/bin/sh
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 ;;
"Headphones") pactl set-sink-port 0 analog-output-headphones ;;
esac