feat: start at login from the tray or the window's settings menu #25

Merged
jfro merged 1 commit from feat/18-start-at-login into main 2026-11-30 18:27:58 +00:00
Owner

Closes #18

What

  • Start at Login is a check item in the tray menu, and also in a new settings menu (gear button in the sidebar footer). It is off by default, and the packages are unchanged.
  • Turning it on writes $XDG_CONFIG_HOME/autostart/krane.desktop (or ~/.config/autostart/…). That entry starts Krane in the tray only: Exec has no --show. Turning it off removes the file.

How (following Nye's notes on #18)

  • The file is the setting; there is no saved bool. It reads as on while the file exists, unless the desktop turned it off (Hidden=true or X-GNOME-Autostart-enabled=false). So deleting the file, or turning it off in the desktop's startup settings, shows as off in both menus. The window re-reads it each time the menu opens, and the tray re-reads it whenever it rebuilds its menu.
  • Exec is krane when it's on PATH (deb/rpm). Otherwise it is this binary's own path (tarball installs), quoted per the Desktop Entry spec (spaces, ", $, `, \, %%).
  • The file is written atomically (temp file, then rename), and the folder is created if missing. X-GNOME-Autostart-Delay=3 gives the tray host time to come up at login. /etc/xdg/autostart is never touched.
  • After a change in the window, the tray menu refreshes too (tray::refresh).
  • MenuEntry now supports checkable (a check mark). New screenshot scene settings.

Tests

  • Unit: the entry has no --show, Exec quoting, the desktop's off keys, and writing, rewriting and removing the file (in a temp dir).
  • By hand on Xfce (with XDG_CONFIG_HOME set to a temp dir): window menu on → file written; the tray showed it checked; tray toggle off → file removed.
  • Not tried: a real log-out/log-in. Nye, could you check that on Xfce?
  • Local CI run passed: fmt, clippy with and without mock, build, and tests (18 + 21 pass).

Stacked on #24 (feat/17-image-pull).

Settings Light
settings settings light
Closes #18 **What** - **Start at Login** is a check item in the tray menu, and also in a new settings menu (gear button in the sidebar footer). It is off by default, and the packages are unchanged. - Turning it on writes `$XDG_CONFIG_HOME/autostart/krane.desktop` (or `~/.config/autostart/…`). That entry starts Krane in the **tray only**: Exec has no `--show`. Turning it off removes the file. **How** (following Nye's notes on #18) - The file is the setting; there is no saved bool. It reads as on while the file exists, unless the desktop turned it off (`Hidden=true` or `X-GNOME-Autostart-enabled=false`). So deleting the file, or turning it off in the desktop's startup settings, shows as off in both menus. The window re-reads it each time the menu opens, and the tray re-reads it whenever it rebuilds its menu. - Exec is `krane` when it's on PATH (deb/rpm). Otherwise it is this binary's own path (tarball installs), quoted per the Desktop Entry spec (spaces, `"`, `$`, `` ` ``, `\`, `%%`). - The file is written atomically (temp file, then rename), and the folder is created if missing. `X-GNOME-Autostart-Delay=3` gives the tray host time to come up at login. `/etc/xdg/autostart` is never touched. - After a change in the window, the tray menu refreshes too (`tray::refresh`). - `MenuEntry` now supports `checkable` (a check mark). New screenshot scene `settings`. **Tests** - Unit: the entry has no `--show`, Exec quoting, the desktop's off keys, and writing, rewriting and removing the file (in a temp dir). - By hand on Xfce (with `XDG_CONFIG_HOME` set to a temp dir): window menu on → file written; the tray showed it checked; tray toggle off → file removed. - Not tried: a real log-out/log-in. Nye, could you check that on Xfce? - Local CI run passed: fmt, clippy with and without `mock`, build, and tests (18 + 21 pass). Stacked on #24 (`feat/17-image-pull`). | Settings | Light | | --- | --- | | ![settings](https://git.knope.dev/attachments/55f1e90e-c9b0-4bf7-a763-e1705a5bb1b9) | ![settings light](https://git.knope.dev/attachments/8beb1dc7-3960-4d6a-beaa-d098dfa56d9b) |
feat: start at login from the tray or the window's settings menu
All checks were successful
CI / test (pull_request) Successful in 4m40s
e013ef52de
jfro force-pushed feat/18-start-at-login from e013ef52de
All checks were successful
CI / test (pull_request) Successful in 4m40s
to 440c6b710f
All checks were successful
CI / test (pull_request) Successful in 5m39s
2026-11-30 16:31:28 +00:00
Compare
Author
Owner

Rebased on #24 at 1848c37; now 440c6b7. No changes to #18 itself.

Rebased on #24 at 1848c37; now 440c6b7. No changes to #18 itself.
jfro left a comment

Review from Nye (posted by Upper Wolfjaw; Nye can't comment here).

PR #25 (#18 start at login) review, head e013ef5 — REQUEST CHANGES (1 finding)

Check C5 passes: fmt, clippy -D warnings (with/without mock), 18 tests, mock build.

Live on Xfce (real panel, real Docker):

  • Tray "Start at Login" checkmark toggles; file written/removed; menu checkmark updates.
  • Sidebar gear menu toggles; tray menu follows (tray::refresh works); reopening the menu shows the right state.
  • Exec has no --show (Exec= or krane when on PATH). Hidden=true in the file reads as off in both menus; turning on overwrites it.
  • Read-only ~/.config/autostart: alert "Couldn't change Start at Login / Permission denied (os error 13)", check mark reverts.

F6 (medium) — no tray icon when Krane starts before the panel's tray

At login, xfce4-session can start autostart apps before xfce4-panel's StatusNotifierWatcher is on the bus
(X-GNOME-Autostart-Delay is GNOME-only). tray.spawn() then fails with ServiceUnknown, tray.rs logs
"Failed to create tray" and returns, but Krane keeps running: no icon, no window. Nothing re-registers later.
Proof: notes/pr25-f6-proof.sh (+ notes/sni_watcher.py, a minimal watcher). Runs Krane on a private session bus,
starts the watcher 3 s later, checks Krane registers. Fails on e013ef5.
Fix (tested, proof passes): src/tray.rs tray.assume_sni_available(true).spawn().await — ksni 0.3 then
registers when the watcher's name appears (service.rs NameOwnerChanged loop).

Note (not a separate finding)

docs/screenshots/settings*.png show the "Docker Reported an Error: Pull cancelled" alert behind the menu:
the settings setup step calls cancelPull right after the pull step, which is F3 on PR #24. Regenerate the
screenshots after the F3 fix lands and check settings*.png is clean.

Nits (optional)

  • entry_enabled reads Hidden= in any group, not just [Desktop Entry] (harmless for our own file).
  • Exec=krane whenever any krane is on PATH, even when running a different build; fine for deb/rpm.
_Review from Nye (posted by Upper Wolfjaw; Nye can't comment here)._ # PR #25 (#18 start at login) review, head e013ef5 — REQUEST CHANGES (1 finding) Check C5 passes: fmt, clippy -D warnings (with/without mock), 18 tests, mock build. Live on Xfce (real panel, real Docker): - Tray "Start at Login" checkmark toggles; file written/removed; menu checkmark updates. - Sidebar gear menu toggles; tray menu follows (tray::refresh works); reopening the menu shows the right state. - Exec has no --show (Exec=<path> or krane when on PATH). Hidden=true in the file reads as off in both menus; turning on overwrites it. - Read-only ~/.config/autostart: alert "Couldn't change Start at Login / Permission denied (os error 13)", check mark reverts. ## F6 (medium) — no tray icon when Krane starts before the panel's tray At login, xfce4-session can start autostart apps before xfce4-panel's StatusNotifierWatcher is on the bus (X-GNOME-Autostart-Delay is GNOME-only). tray.spawn() then fails with ServiceUnknown, tray.rs logs "Failed to create tray" and returns, but Krane keeps running: no icon, no window. Nothing re-registers later. Proof: notes/pr25-f6-proof.sh (+ notes/sni_watcher.py, a minimal watcher). Runs Krane on a private session bus, starts the watcher 3 s later, checks Krane registers. Fails on e013ef5. Fix (tested, proof passes): src/tray.rs `tray.assume_sni_available(true).spawn().await` — ksni 0.3 then registers when the watcher's name appears (service.rs NameOwnerChanged loop). ## Note (not a separate finding) docs/screenshots/settings*.png show the "Docker Reported an Error: Pull cancelled" alert behind the menu: the settings setup step calls cancelPull right after the pull step, which is F3 on PR #24. Regenerate the screenshots after the F3 fix lands and check settings*.png is clean. ## Nits (optional) - entry_enabled reads Hidden= in any group, not just [Desktop Entry] (harmless for our own file). - Exec=krane whenever any `krane` is on PATH, even when running a different build; fine for deb/rpm.
jfro force-pushed feat/18-start-at-login from 440c6b710f
All checks were successful
CI / test (pull_request) Successful in 5m39s
to 451e8afdca
All checks were successful
CI / test (pull_request) Successful in 5m14s
CI / test (push) Successful in 4m52s
2026-11-30 17:10:06 +00:00
Compare
jfro changed target branch from feat/17-image-pull to main 2026-11-30 17:41:53 +00:00
jfro merged commit 451e8afdca into main 2026-11-30 18:27:58 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/krane!25
No description provided.