aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2021-08-28 15:40:48 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2021-08-28 15:40:48 +0200
commitf7422dc4209372c092783d9ba58fe1c56923237f (patch)
tree865443c2045294e644904b4bb240418c8951ed27
parentad1304949a2041a7a05d35fe16217f0f6f26fb8d (diff)
downloaddotfiles-f7422dc4209372c092783d9ba58fe1c56923237f.tar.gz
bash: spotify sink
-rw-r--r--bash/spotify.bash3
-rw-r--r--bash/spotify.profile9
2 files changed, 12 insertions, 0 deletions
diff --git a/bash/spotify.bash b/bash/spotify.bash
new file mode 100644
index 0000000..1593727
--- /dev/null
+++ b/bash/spotify.bash
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+[ -n "$SPOTIFY_SINK" ] && alias spotify="PULSE_SINK=$SPOTIFY_SINK spotify"
diff --git a/bash/spotify.profile b/bash/spotify.profile
new file mode 100644
index 0000000..33d0938
--- /dev/null
+++ b/bash/spotify.profile
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+SPOTIFY_OUTPUT_REGEX="BurrBrown"
+
+while read -r NUM NAME REST; do
+ [[ "$NAME" =~ $SPOTIFY_OUTPUT_REGEX ]] && SPOTIFY_SINK=$NUM
+done <<< "$(pactl list short sinks)"
+
+export SPOTIFY_SINK