Start at login #18

Closed
opened 2026-11-30 14:39:42 +00:00 by jfro · 1 comment
Owner

What

  • A setting (and tray menu toggle) that writes or removes ~/.config/autostart/krane.desktop (XDG autostart), launching the tray only (no --show).
  • Ship the setting off by default; packages stay unchanged.
**What** - A setting (and tray menu toggle) that writes or removes `~/.config/autostart/krane.desktop` (XDG autostart), launching the tray only (no `--show`). - Ship the setting off by default; packages stay unchanged.
jfro added this to the v1.0 milestone 2026-11-30 14:47:14 +00:00
Author
Owner

Approach notes (Nye, review; tested on Docker 26 + rootless Podman 5.4.2)

#18 Start at login

Reuse: packaging/krane.desktop as the template (Name/Icon/Comment), but Exec without --show (tray only, as the issue says).
Write $XDG_CONFIG_HOME/autostart/krane.desktop (fallback ~/.config); remove it to turn off. No new crate needed (std::fs; or dirs if already pulled in; it isn't in Cargo.toml).
Must-dos:

  1. Exec: krane if the installed binary is on PATH (deb/rpm put it in /usr/bin), else std::env::current_exe() (tarball installs), quoted per the desktop-entry spec if it has spaces. Never write a path under target/ from a dev run silently; fine to just use current_exe.
  2. State is the file, not a saved bool: read it on startup so the tray/setting match if the user deleted it or a DE disabled it (Hidden=true or X-GNOME-Autostart-enabled=false in the file = off).
  3. Don't touch /etc/xdg/autostart; packages unchanged; default off.
  4. Add X-GNOME-Autostart-Delay=3 (harmless elsewhere): at login the tray host (StatusNotifierWatcher) may not be up yet. Review check: log out/in on Xfce with it on, tray icon appears.
  5. Write atomically (temp + rename); create the autostart dir if missing.
  6. Settings file: if #16 lands first, reuse its ~/.config/krane/settings.json only for UI prefs; autostart stays file-backed.
**Approach notes (Nye, review; tested on Docker 26 + rootless Podman 5.4.2)** ## #18 Start at login Reuse: `packaging/krane.desktop` as the template (Name/Icon/Comment), but **Exec without `--show`** (tray only, as the issue says). Write `$XDG_CONFIG_HOME/autostart/krane.desktop` (fallback `~/.config`); remove it to turn off. No new crate needed (std::fs; or `dirs` if already pulled in; it isn't in Cargo.toml). Must-dos: 1. Exec: `krane` if the installed binary is on PATH (deb/rpm put it in /usr/bin), else `std::env::current_exe()` (tarball installs), quoted per the desktop-entry spec if it has spaces. Never write a path under `target/` from a dev run silently; fine to just use current_exe. 2. State is the file, not a saved bool: read it on startup so the tray/setting match if the user deleted it or a DE disabled it (`Hidden=true` or `X-GNOME-Autostart-enabled=false` in the file = off). 3. Don't touch `/etc/xdg/autostart`; packages unchanged; default off. 4. Add `X-GNOME-Autostart-Delay=3` (harmless elsewhere): at login the tray host (StatusNotifierWatcher) may not be up yet. Review check: log out/in on Xfce with it on, tray icon appears. 5. Write atomically (temp + rename); create the autostart dir if missing. 6. Settings file: if #16 lands first, reuse its `~/.config/krane/settings.json` only for UI prefs; autostart stays file-backed.
jfro closed this issue 2026-11-30 18:27:58 +00:00
Sign in to join this conversation.
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#18
No description provided.