diff options
| author | Anton Bobov <anton@bobov.name> | 2026-04-20 13:32:33 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2026-07-24 14:21:46 +0500 |
| commit | f8ee0b083ea75630845a8fbe6662de2e97fa09a3 (patch) | |
| tree | b1530b0b03c5f788629ae80316f78e8788ab95d1 /mic-toggle | |
| parent | 1de46b8a4ad776d1e429785d99a199572db441a1 (diff) | |
mic-toggle: add 1-hour mic-on reminder and manage pw-loopback process
Diffstat (limited to 'mic-toggle')
| -rwxr-xr-x | mic-toggle | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -3,17 +3,31 @@ set -euo pipefail JACK_SOURCE=alsa_input.pci-0000_07_00.6.HiFi__hw_Generic_1__source +ALERT_TIME="1 hour" +ALERT_QUEUE=m get_noise_torch_device_name() { pactl list sources short | grep NoiseTorch | awk -F '\t' '{print $2}' || return 0 } +cancel_alert() { + atq -q "$ALERT_QUEUE" | cut -f 1 | xargs -r atrm +} + +add_alert() { + at now + "$ALERT_TIME" -q "$ALERT_QUEUE" <<<"alert 'Toggle mic'" 2>/dev/null +} + main() { + cancel_alert if [ -z "$(get_noise_torch_device_name)" ]; then noisetorch -i "$JACK_SOURCE" pactl set-default-source "$(get_noise_torch_device_name)" + pw-loopback & + add_alert else noisetorch -u + pkill -x pw-loopback || true fi } |
