Files

49 lines
2.4 KiB
Desktop File

[Unit]
Description=Proton Drive Files-On-Demand mount
Documentation=https://github.com/narrrl/proton-drive-linux
# Tie the mount to the desktop session: start after it is up and stop with it.
After=graphical-session.target
PartOf=graphical-session.target
[Service]
# Deliberately not Type=notify: the daemon waits for a stored login before it
# mounts anything, and a machine that boots before the user logs in would then
# fail the unit on the start timeout. NotifyAccess=main gets the daemon a
# NOTIFY_SOCKET all the same, which is all the watchdog below needs, and keeps
# its children (fusermount3, ffmpeg, exiftool) from answering the watchdog for
# it. "all" let any of them do so.
#
# Most sandboxing options are left out on purpose: in a user unit, every
# seccomp-based one (SystemCallFilter, LockPersonality, RestrictAddressFamilies
# and the like) implies NoNewPrivileges, which stops the setuid fusermount3
# from mounting anything.
Type=simple
NotifyAccess=main
# The daemon waits for a stored login, mounts ~/ProtonDrive, and keeps it
# mounted. SIGTERM (from `systemctl --user stop`) triggers a clean lazy unmount.
ExecStart=/usr/bin/pdfs daemon
# Always, not on-failure: a daemon that hangs is not a failure by exit code, and
# on 2026-09-18 one had to be restarted by hand after wedging overnight.
Restart=always
RestartSec=3
# The supervisor thread pings this, but only after a round trip over the control
# socket — so a daemon that stops answering its own clients is restarted instead
# of sitting there looking alive. It pings at half this interval.
WatchdogSec=120
# Backstop against unbounded growth: the hung run peaked at 5.2G resident.
# MemoryHigh throttles and reclaims first; MemoryMax is the hard stop, above any
# legitimate working set, so it only fires on a leak.
MemoryHigh=2G
MemoryMax=6G
# Give the lazy unmount time to finish before SIGKILL.
TimeoutStopSec=15
[Install]
# Not default.target: that is reached before the desktop has exported DISPLAY /
# WAYLAND_DISPLAY to the user manager, so After= above never orders anything
# (the two targets are not in the same start transaction). The daemon's first
# keyring call then D-Bus-activates the Secret Service without a display —
# on KDE ksecretd aborts, the start fails, and every login leaves a coredump.
# Being pulled in by the graphical session starts it only once that is up.
WantedBy=graphical-session.target