summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmic-toggle20
1 files changed, 20 insertions, 0 deletions
diff --git a/mic-toggle b/mic-toggle
new file mode 100755
index 0000000..f21ba3e
--- /dev/null
+++ b/mic-toggle
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+JACK_SOURCE=alsa_input.pci-0000_07_00.6.HiFi__hw_Generic_1__source
+
+get_noise_torch_device_name() {
+ pactl list sources short | grep NoiseTorch | awk -F '\t' '{print $2}' || return 0
+}
+
+main() {
+ if [ -z "$(get_noise_torch_device_name)" ]; then
+ noisetorch -i "$JACK_SOURCE"
+ pactl set-default-source "$(get_noise_torch_device_name)"
+ else
+ noisetorch -u
+ fi
+}
+
+main