Repository navigation
Start the systemd unit's daemon without --tray when no display is available - #4407
Merged
Merged
Conversation
…ilable The app-written unit passed --tray unconditionally; on a host with no DISPLAY or WAYLAND_DISPLAY the tray panics in GTK and Restart=on-failure crash-loops the unit. The unit now omits the flag without a display, the choice is logged, and the run-the-app guide states what a scratch launch on Linux shares with the real home. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The unit is written from the app's environment but started by the user manager, whose environment may lack DISPLAY/WAYLAND_DISPLAY. On Linux the daemon now runs headless with a warning in that case; the decision is a pure function tested on every platform. Also fixes rustfmt of a test import. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
mstomar125
force-pushed
the
linux-headless-unit
branch
from
November 30, 2026 07:05
617ea89 to
3147e7b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
--traywhen neitherDISPLAYnorWAYLAND_DISPLAYis set (non-empty) in the app's environment; with a display it is unchanged. The choice is logged at install ("with --tray" / "headless, without --tray").--trayrow now describes the fix; it states exactly what a scratch Linux launch shares with the real home (theenablesymlink in~/.config/systemd/user/default.target.wants/and thenodespace.servicename) and how to avoid it (the transientsystemd-run --userunit already documented).Why
Title: "A headless Linux install does not run the daemon with the tray flag, so it does not crash-loop without a display" and "A scratch launch of the app on Linux can get a service unit the user manager loads, and the run-the-app guide says how".
Daemon-side fallback
On Linux, when
--trayis requested but neitherDISPLAYnorWAYLAND_DISPLAYis set and non-empty in the daemon's own environment (the user manager's environment can lack the app's), the daemon logs a warning and runs headless. The decision is the puretray_or_headlessinpackages/daemon/src/main.rs; only the wiring is cfg-gated to Linux (macOS/Windows unchanged).Tests
cargo test -p nodespace-app-lib --lib systemd_enable_tests(10 pass): unit with tray ends in--tray; unit without has a bareExecStart="..."and no--tray;systemd_wants_traytruth table (DISPLAY, WAYLAND_DISPLAY, neither, both empty).Mutation checks
Unit: always-tray, never-tray, empty-counts-as-display, ignore-Wayland: each fails at least one new/updated test.
Daemon fallback (
tray_fallback_tests, 3 tests): failing first (tray-ignores-display stub failed the headless test), then mutations: ignore display check, ignorerequested, ignore Wayland, empty-counts-as-set; each fails a test.Checks
cargo fmt --all --checkclean;cargo clippy -p nodespace-app-lib -p nodespace-daemon --all-targets -- -D warningsclean (macOS host).Not verified
effective_tray_mode) is not compiled on the macOS host; CI Linux builds cover it.--traybeing the only trigger of the GTK panic (as documented in the guide) plus the unit text test.--trayuntil the app re-registers.🤖 Generated with Claude Code