From bfa9669595216ebd35c43d352e57436433772aec Mon Sep 17 00:00:00 2001 From: cronyakatsuki Date: Sun, 22 May 2022 19:37:41 +0200 Subject: [PATCH] Script that allows me to change whether the audio comes from the headphones or speaker without having to unplug them. --- dmenu-pulse-port-man | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 dmenu-pulse-port-man diff --git a/dmenu-pulse-port-man b/dmenu-pulse-port-man new file mode 100755 index 0000000..9cfee9c --- /dev/null +++ b/dmenu-pulse-port-man @@ -0,0 +1,13 @@ +#!/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