From 09ada24d4ec23cf24ab136141b354953d1bbc2fa Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sun, 17 Nov 2024 23:34:54 -0600 Subject: reorganize scripts --- .old/sinkswitch | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 .old/sinkswitch (limited to '.old/sinkswitch') diff --git a/.old/sinkswitch b/.old/sinkswitch new file mode 100755 index 0000000..3046498 --- /dev/null +++ b/.old/sinkswitch @@ -0,0 +1,15 @@ +#!/bin/sh +[ $(hostname) != 'T495' ] && echo "Not T495. Exiting" && exit 1 + +status="$(wpctl status)" + +headphones_sink=$(echo "$status" | grep -m1 'ThinkPad USB-C Dock Gen2 USB Audio Analog Stereo \[vol:' | grep -m1 -o '[0-9]*') +speakers_sink=$( echo "$status" | grep -m1 'Raven/Raven2/Fenghuang HDMI/DP Audio Controller Digital Stereo (HDMI 2) \[vol:' | grep -m1 -o '[0-9]*') + +selected_sink=$(echo "$status" | grep -m1 '\*\s*[0-9]*' | grep -o '[0-9]*') + +case $selected_sink in + $headphones_sink) wpctl set-default $speakers_sink && echo "Switched to speakers" ;; + $speakers_sink) wpctl set-default $headphones_sink && echo "Switched to headphones" ;; + *) echo "Cannot find correct sink. Exiting" && exit 1 ;; +esac -- cgit v1.2.3