summaryrefslogtreecommitdiff
path: root/mic-toggle
blob: f21ba3ef3f1850a7fca2cf057b9c161c4ca7ecb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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