summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.local/bin/swsnd18
1 files changed, 18 insertions, 0 deletions
diff --git a/.local/bin/swsnd b/.local/bin/swsnd
new file mode 100755
index 0000000..d64a034
--- /dev/null
+++ b/.local/bin/swsnd
@@ -0,0 +1,18 @@
+#!/bin/csh
+
+set cmd = 'sysctl hw.snd.default_unit'
+
+if ($#argv > 0) then
+ $cmd=$1 >&/dev/null
+else if (`$cmd | rev | cut -d ' ' -f 1` == 0) then
+ $cmd=4 >&/dev/null
+else
+ $cmd=0 >&/dev/null
+endif
+exec notify-send \
+ -u low \
+ -t 2000 \
+ 'swsnd' \
+ "Switched to `grep default /dev/sndstat | \
+ sed -e 's/.*<\(.*\)>.*/\1/' | \
+ sed -e 's/.*(\(.*\)).*/\1/'`"