aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/scripts/switch_audio.sh
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/scripts/switch_audio.sh')
-rwxr-xr-xdotfiles/scripts/switch_audio.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/dotfiles/scripts/switch_audio.sh b/dotfiles/scripts/switch_audio.sh
new file mode 100755
index 0000000..aff2543
--- /dev/null
+++ b/dotfiles/scripts/switch_audio.sh
@@ -0,0 +1,16 @@
+#/bin/sh
+
+# Usage :
+# switch_audio.sh <sinkport_number>
+
+headphones="analog-output-headphones"
+lineout="analog-output-lineout"
+sinkport="$1"
+
+if [[ $(echo $(pacmd list | grep "active port") | cut -d" " -f3 | cut -d"<" -f2 | cut -d">" -f1) == $lineout ]]
+then
+ pacmd set-sink-port $sinkport $headphones
+ elif [[ $(echo $(pacmd list | grep "active port") | cut -d" " -f3 | cut -d"<" -f2 | cut -d">" -f1) == $headphones ]]
+ then
+ pacmd set-sink-port $sinkport $lineout
+ fi