Repository navigation
linux,macos: start-at-login adapters behind the startup seam (#215) - #672
Conversation
Slice A of the platform breakdown. src/linux-startup.js manages an XDG autostart .desktop entry (XDG_CONFIG_HOME/autostart or ~/.config/ autostart, spec quoting and escaping for Exec); src/macos-startup.js manages a per-user LaunchAgent (~/Library/LaunchAgents/ dev.rowkav.nowplaying.plist, XML-escaped, plutil-linted on macOS CI). Both mirror the windows-startup contract - status / isEnabled / setEnabled, missing file is disabled, a stale entry pointing elsewhere is broken and re-enabling repairs it - and both read only their own named file, so no arbitrary paths leave the Settings API. Enabling takes effect at the next login, matching the Windows shortcut (no launchctl bootstrap, so this also works from a headless shell). scripts/nowplaying.js wires them in, so the existing 'Launch app on system startup' settings control now works on Linux and macOS. Sequencing: this is main-branch code, not a platform release, so it does not jump the issue's 'blocked behind the Windows v0.2.0 testable release' note.
|
CHANGES REQUESTED at exact head
Targeted Linux/macOS adapter tests pass 12/12 with the macOS-only |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Review rework on c8e6012: - macOS: status compared only the first ProgramArguments string, so an agent whose script or arguments were edited still read enabled. It now compares the whole command vector (XML-unescaped), and regression tests cover an edited script path and a dropped argument - Linux: an entry with Hidden=true or X-GNOME-Autostart-enabled=false is disabled by the desktop even though the file matches, so status now reports broken (settings shows off, re-enabling repairs the entry), with regression tests for both keys
|
Rework on the review, new head 3663391:
16/16 startup tests pass; full suite 1149 pass locally. |
|
CHANGES STILL REQUESTED at exact head One related status false-positive remains: |
Review rework on 3663391: a LaunchAgent whose RunAtLoad is flipped to false (or dropped) cannot start at login, and an edited Label breaks the agent's identity with launchd - but status read both as enabled. Status now requires the full command vector, the expected Label and RunAtLoad=true; regression tests cover the flip, the missing key and the edited Label.
|
Rework, new head ffa46f6: status now requires the full command |
|
CHANGES STILL REQUESTED at exact head A Linux |
Review rework on ffa46f6: the XDG desktop entry spec requires a literal % as %% (single percent signs start field codes like %f and %U that the launcher expands or rejects). Exec parts now double % on write; the status comparison stays byte-for-byte against the escaped form, so a hand-edited single % reads as broken. Tests cover the 100% done path round trip and the invalid single-% case.
|
Rework, new head 5e9ef05: Exec parts now double literal % on write |
|
CHANGES STILL REQUESTED at exact head I found another desktop-entry reserved character omitted from |
Review rework on 5e9ef05: the desktop entry spec reserves ; alongside the other shell punctuation, so an unquoted /home/u/a;b path produced an entry desktop-file-validate rejects. ; is now in the quoting class, and a validator-backed test asserts the written entry passes desktop-file-validate where the tool is installed (skips elsewhere).
|
Rework, new head f28dbd9: semicolon added to the Exec quoting |
|
APPROVE at exact head |
Slice A of the #215 breakdown (scoping comment). Sequencing note: this is main-branch code, not a platform release, so it does not jump the issue's "blocked behind the Windows v0.2.0 testable release" note.
What
src/linux-startup.js- XDG autostart.desktopentry ($XDG_CONFIG_HOME/autostartor~/.config/autostart), with desktop-entry-spec quoting/escaping forExec. XDG only; no systemd user unit (flagged as Rowan's call in the breakdown).src/macos-startup.js- per-user LaunchAgent~/Library/LaunchAgents/dev.rowkav.nowplaying.plist, XML-escaped; the written plist passesplutil -linton macOS (test runs in the macOS CI job).windows-startupcontract:status()/isEnabled()/setEnabled(), a missing file is disabled (not broken), an entry pointing at a moved binary reports broken and re-enabling repairs it. Like the Windows side, they read only their own named file, so no arbitrary paths leave the Settings API.launchctl bootstrap, so this also works from a headless shell.scripts/nowplaying.jswires them intostartAppFromConfig, so the existing "Launch app on system startup" settings control (which renders fromstartup.available) now works on Linux and macOS. Entry points at this samenode scripts/nowplaying.js startcommand; packaged builds (slice B) will pass their bundle path instead.Tests
12 new cases: dir resolution (XDG rules, HOME required), missing/disabled, enable -> status -> disable round trips with content assertions, stale-entry broken/repair, quoting/escaping (spaces,
$, XML entities), input validation, andplutil -linton macOS. Full suite: 1145 pass locally (including the labeler rules for the new files).