From b3646bc382fba20201e1010bfe969963ab447c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Wed, 25 Jun 2025 01:41:26 +0200 Subject: [PATCH] System Gen79 @ 2025-06-25-01:41:25 by jonas@monolith --- modules/hardware/sound.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/hardware/sound.nix b/modules/hardware/sound.nix index 3b7802f..f9c24da 100644 --- a/modules/hardware/sound.nix +++ b/modules/hardware/sound.nix @@ -48,7 +48,23 @@ in { requires = ["pipewire.service"]; serviceConfig = { Type = "oneshot"; - ExecStart = "${pkgs.noisetorch}/bin/noisetorch -i -t ${toString cfg.noisetorch-threshold}"; + ExecStart = "${pkgs.writeShellScript "load-noisetorch" '' + set -euo pipefail + NOISETORCH="${pkgs.noisetorch}/bin/noisetorch" + WPCTL="${pkgs.wireplumber}/bin/wpctl" + GREP="${pkgs.gnugrep}/bin/grep" + AWK="${pkgs.gawk}/bin/awk" + HEAD="${pkgs.coreutils}/bin/head" + + $NOISETORCH -i -t ${toString cfg.noisetorch-threshold}; + sleep 2 + FILTER_ID=$($WPCTL status | $GREP "NoiseTorch" | $AWK '{print $2}' | $HEAD -c-2) + if [ -n "$FILTER_ID" ]; then + $WPCTL set-default $FILTER_ID + else + echo "Noisetorch filter not found, skipping setting default source." + fi + ''}"; ExecStop = "${pkgs.noisetorch}/bin/noisetorch -u"; RemainAfterExit = true; };