Last active
April 12, 2020 14:54
-
-
Save dontdieych/bd534db04d2cf99c5681967a6d60577a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
function active-port | |
pacmd list-sinks |\ | |
rg 'active port:' |\ | |
tr -s ' ' |\ | |
cut -d: -f2 |\ | |
string trim | |
end | |
set -l _active_port (active-port) | |
echo "Active:$_active_port" | |
switch $_active_port | |
case '<analog-output-speaker>' | |
pacmd set-sink-port 0 analog-output-headphones | |
case '<analog-output-headphones>' | |
pacmd set-sink-port 0 analog-output-speaker | |
case '*' | |
exit 1 | |
end | |
echo | |
echo "Changed:"(active-port) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment