# systemd USER drop-in: bind the host to the DESKTOP LOGIN session's lifetime. # # Install (on top of punktfunk-host.service): # mkdir -p ~/.config/systemd/user/punktfunk-host.service.d # cp scripts/punktfunk-host-desktop-session.conf \ # ~/.config/systemd/user/punktfunk-host.service.d/desktop-session.conf # systemctl --user daemon-reload # systemctl --user reenable punktfunk-host # picks up the [Install] below # systemctl --user restart punktfunk-host # # WHY: the shipped unit's `PartOf=punktfunk-kde-session.service` covers the APPLIANCE route, where we # start the compositor ourselves. A host on a machine somebody logs into has no such unit — so when # Plasma or GNOME restarts (a crash, a session logout/login, "restart the shell"), the daemon keeps # running while holding a Wayland socket and a portal D-Bus connection that both died with the old # compositor. It cannot recover those in-process. It is a quiet failure — the host still listens, still # answers, and every session it then serves fails at capture. A host that mirrors a monitor # (design/per-monitor-portal-capture.md) sits idle for days between sessions, which is exactly the # shape that gets discovered at the worst moment. # # `graphical-session.target` is the session's own lifetime, reached by GNOME and Plasma under systemd # session management. `PartOf=` stops us when it goes down; the `WantedBy=` below starts us again when # the new session brings it back up. So a compositor restart becomes a host restart, with a fresh # connection to the compositor that is actually there. # # NOT for the appliance/headless route (a pinned PUNKTFUNK_COMPOSITOR, punktfunk-kde-session.service, # a gamescope box): those have their own session unit and may never reach graphical-session.target at # all, and this drop-in would leave the host permanently stopped. # # Sway / Hyprland / any session NOT managed by systemd never reaches graphical-session.target either. # There the drop-in is harmless but does nothing; start the host from the compositor's own config # instead (`exec systemctl --user start punktfunk-host` after `systemctl --user import-environment`), # so it dies and comes back with the session. [Unit] After=graphical-session.target PartOf=graphical-session.target [Install] # In ADDITION to the base unit's WantedBy=default.target, so the host still comes up at login even # before the graphical session is ready — it listens without touching the compositor and only opens # one per client connect, so an early start costs nothing. WantedBy=graphical-session.target