summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2022-04-29 10:42:31 +0200
committerJoe <bousset.rudy@gmail.com>2022-04-29 10:42:31 +0200
commitc3d8379045c72577a2284d3d1f75f191e3dee19c (patch)
tree05b66102895ed4787c840ae30c9b380ef4a38294 /.local/bin
parentupdate (diff)
downloaddotfiles-bsd-c3d8379045c72577a2284d3d1f75f191e3dee19c.tar.gz
dotfiles-bsd-c3d8379045c72577a2284d3d1f75f191e3dee19c.tar.bz2
dotfiles-bsd-c3d8379045c72577a2284d3d1f75f191e3dee19c.tar.xz
dotfiles-bsd-c3d8379045c72577a2284d3d1f75f191e3dee19c.tar.zst
dotfiles-bsd-c3d8379045c72577a2284d3d1f75f191e3dee19c.zip
New script to change sound card
Diffstat (limited to '')
-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/'`"