aboutsummaryrefslogtreecommitdiff
path: root/scripts/mute
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mute')
-rwxr-xr-xscripts/mute31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/mute b/scripts/mute
new file mode 100755
index 0000000..1103c0e
--- /dev/null
+++ b/scripts/mute
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+SOURCE="alsa_input.usb-R__DE_Microphones_R__DE_NT-USB_Mini_610BAACA-00.mono-fallback"
+
+if [[ "$1" == "shortstatus" ]]; then
+ VOLUME="$(pactl get-source-volume "$SOURCE" | grep -o [0-9]*%)"
+
+ if [[ "$VOLUME" == "0%" ]]; then
+ echo "OFF"
+ else
+ echo "ON"
+ fi
+
+ exit
+fi
+
+if [[ "$1" == "status" ]]; then
+ NAME="$(pactl list sources | grep -o Description:.* | sed -n 's/Description: //g;2p')"
+ VOLUME="$(pactl get-source-volume "$SOURCE" | grep -o [0-9]*%)"
+
+ echo "$NAME ($VOLUME)"
+
+ exit
+fi
+
+if [[ "$(pactl get-source-volume $SOURCE | grep -o [0-9]*%)" == "0%" ]]; then
+ pactl set-source-volume "$SOURCE" 70%
+else
+ pactl set-source-volume "$SOURCE" 0%
+fi
+