diff options
| author | alex <[email protected]> | 2026-11-02 21:58:59 +0100 |
|---|---|---|
| committer | alex <[email protected]> | 2026-11-02 21:59:07 +0100 |
| commit | 6d62422d8ef66aacde2e0f75c5f74bd64c28979f (patch) | |
| tree | 469629bde68ec6dd7891d1eddde4a67be4edb60b /hosts/phosphophyllite | |
| parent | 9ba7bbdbc9ca85bc97df19e6d52288e2d76c9464 (diff) | |
| download | nixos-6d62422d8ef66aacde2e0f75c5f74bd64c28979f.tar.xz nixos-6d62422d8ef66aacde2e0f75c5f74bd64c28979f.zip | |
idk bro
Diffstat (limited to 'hosts/phosphophyllite')
| -rw-r--r-- | hosts/phosphophyllite/default.nix | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/hosts/phosphophyllite/default.nix b/hosts/phosphophyllite/default.nix index 311b9b5..ead7012 100644 --- a/hosts/phosphophyllite/default.nix +++ b/hosts/phosphophyllite/default.nix @@ -94,6 +94,37 @@ }; }; + systemd.user.services.audio-default-sink = { + description = "Force default sink to speakers"; + wantedBy = [ "graphical-session.target" ]; + after = [ + "graphical-session.target" + "pipewire-pulse.service" + "wireplumber.service" + ]; + serviceConfig = { + Type = "oneshot"; + }; + script = '' + for _ in $(${pkgs.coreutils}/bin/seq 1 20); do + ${pkgs.pulseaudio}/bin/pactl info >/dev/null 2>&1 && break + sleep 1 + done + + ${pkgs.pulseaudio}/bin/pactl set-default-sink alsa_output.pci-0000_0a_00.4.analog-stereo || true + + inputs="$(${pkgs.pulseaudio}/bin/pactl list short sink-inputs | ${pkgs.gawk}/bin/awk '{print $1}' || true)" + if [ -n "$inputs" ]; then + while read -r input; do + [ -z "$input" ] && continue + ${pkgs.pulseaudio}/bin/pactl move-sink-input "$input" alsa_output.pci-0000_0a_00.4.analog-stereo || true + done <<EOF +$inputs +EOF + fi + ''; + }; + systemd.timers.sunshine-poweroff = { description = "Shutdown desktop 15 minutes after Sunshine disconnect"; timerConfig = { |
