From f876db669548e1e383dce91df9b4a8de759f5827 Mon Sep 17 00:00:00 2001 From: developomp Date: Thu, 7 Jul 2022 10:21:01 +0900 Subject: [PATCH] make noisetorch autostart --- home/.config/systemd/user/noisetorch.service | 16 ++++++++++++++++ src/setup/system/noisetorch.py | 10 +++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 home/.config/systemd/user/noisetorch.service diff --git a/home/.config/systemd/user/noisetorch.service b/home/.config/systemd/user/noisetorch.service new file mode 100644 index 0000000..76149da --- /dev/null +++ b/home/.config/systemd/user/noisetorch.service @@ -0,0 +1,16 @@ +[Unit] +Description=Noisetorch +Requires=sys-devices-pci0000:00-0000:00:14.0-usb1-1\x2d2-1\x2d2.1-1\x2d2.1:1.0-sound-card1-controlC1.device +After=sys-devices-pci0000:00-0000:00:14.0-usb1-1\x2d2-1\x2d2.1-1\x2d2.1:1.0-sound-card1-controlC1.device +After=pipewire.service + +[Service] +Type=simple +RemainAfterExit=yes +ExecStart=/usr/bin/noisetorch -i -s alsa_input.usb-GeneralPlus_USB_Audio_Device-00.mono-fallback -t 25 +ExecStop=/usr/bin/noisetorch -u +Restart=on-failure +RestartSec=3 + +[Install] +WantedBy=default.target diff --git a/src/setup/system/noisetorch.py b/src/setup/system/noisetorch.py index 604be74..cd17d13 100644 --- a/src/setup/system/noisetorch.py +++ b/src/setup/system/noisetorch.py @@ -1,4 +1,4 @@ -from src.util import paru_install +from src.util import paru_install, run, copy_file name = "NoiseTorch" @@ -9,3 +9,11 @@ def setup(): # temporarily using noisetorch-git over noisetorch-bin due to this: # https://github.com/noisetorch/NoiseTorch/issues/274 paru_install("noisetorch-git") + + # Start NoiseTorch on boot + # https://github.com/noisetorch/NoiseTorch/wiki/Start-automatically-with-Systemd + + copy_file("home/.config/systemd/user/noisetorch.service") + run("systemctl --user daemon-reload") + run("systemctl --user start noisetorch") + run("systemctl --user enable noisetorch")