| 1 | [Unit] |
| 2 | Description=automatic loudness and per-app volume control (pipewire) |
| 3 | Documentation=https://github.com/manic-systems/headroom |
| 4 | # pipewire is a hard dep — can't start before pw-mainloop. ConditionUser pins user-scope |
| 5 | After=pipewire.service pipewire-pulse.service wireplumber.service |
| 6 | Requires=pipewire.service |
| 7 | Wants=wireplumber.service |
| 8 | # start with the user's service manager, but do not stop just because |
| 9 | # graphical-session.target is restarted during idle/session churn. |
| 10 | ConditionUser=!@system |
| 11 | |
| 12 | [Service] |
| 13 | Type=simple |
| 14 | ExecStart=@bindir@/headroom daemon |
| 15 | # restart after unexpected daemon exits, including clean main-loop exits. |
| 16 | Restart=always |
| 17 | RestartSec=2s |
| 18 | # sigterm is the clean shutdown path; explicit for clarity |
| 19 | KillMode=control-group |
| 20 | TimeoutStopSec=5s |
| 21 | # logs to journald (journalctl --user -u headroom) |
| 22 | StandardOutput=journal |
| 23 | StandardError=journal |
| 24 | SyslogIdentifier=headroom |
| 25 | # Allow realtime/nice elevation where the user manager has permission |
| 26 | # to grant it. Do not request CPUSchedulingPolicy= here: on systems |
| 27 | # without CAP_SYS_NICE / realtime user limits, systemd fails the unit |
| 28 | # before headroom can start. Users who have configured rt privileges can |
| 29 | # add a drop-in with CPUSchedulingPolicy=rr, CPUSchedulingPriority=20, |
| 30 | # and Nice=-11. |
| 31 | LimitRTPRIO=20 |
| 32 | LimitRTTIME=200000 |
| 33 | LimitNICE=-11 |
| 34 | |
| 35 | [Install] |
| 36 | WantedBy=default.target |