Skip to content

feat(gui): dynamic Dock/menu-bar policy + start-minimized autostart#7

Merged
AprilNEA merged 1 commit into
masterfrom
feat/tray-dynamic-policy
May 31, 2026
Merged

feat(gui): dynamic Dock/menu-bar policy + start-minimized autostart#7
AprilNEA merged 1 commit into
masterfrom
feat/tray-dynamic-policy

Conversation

@AprilNEA
Copy link
Copy Markdown
Owner

Follow-up to #6. Adds the two pieces the static-Accessory tray was missing.

Dynamic activation policy

The activation policy now tracks window presence instead of being permanently Accessory:

  • Window open → Regular (Dock icon + top menu bar). open_main_window calls tray::show_in_dock(), so the app menu (⌘Q, Settings, …) is back whenever a window is up — fixing the static-Accessory regression where it was never available.
  • Last window closed → Accessory (tray only). An on_window_closed observer flips back once cx.windows() is empty (any remaining window — Settings/About — keeps it Regular).

Start-minimized autostart

  • The LaunchAgent plist passes --minimized, so a login-launched instance comes up in the tray with no window.
  • Manual launches (Finder / open) — and every non-macOS platform, which has no tray — still open the window. Re-opening the running app routes through the existing on_reopen handler.
  • Trade-off (accepted): a brief Dock-icon flash on the minimized path, since gpui hardcodes setActivationPolicy(Regular) in did_finish_launching before our run closure.

Notes

  • tray::install no longer sets the policy; show_in_dock / hide_from_dock own it.
  • All of this is cfg(target_os = "macos"); non-macOS start_minimized is always false, so the window always opens.

Verification

cargo fmt, cargo clippy --workspace --all-targets -- -D warnings, and cargo test -p openlogi-gui (incl. the plist --minimized assertion) pass on macOS; Linux/clippy confirmed by this PR's CI.

Make the macOS activation policy track window presence instead of being
statically Accessory: the app shows in the Dock with its menu bar (Cmd-Q,
Settings, ...) whenever a window is open, and drops back to a tray-only
accessory once the last window closes. `open_main_window` flips to Regular;
an `on_window_closed` observer flips to Accessory when `cx.windows()` is empty.

Add start-minimized autostart: the LaunchAgent plist now passes `--minimized`,
so a login-launched instance comes up in the tray with no window (a brief
Dock-icon flash is unavoidable — gpui hardcodes Regular at did_finish_launching,
before our run closure). Manual launches — and every non-macOS platform, which
has no tray — still open the window.
@pullfrog
Copy link
Copy Markdown

pullfrog Bot commented May 31, 2026

  • Checkout PR and read diff
  • Read summary snapshot and learnings
  • Triage and gather context
  • Draft and submit review
  • Update PR summary snapshot

Pullfrog  | View workflow run | via Pullfrog | Using Claude Opus𝕏

@AprilNEA AprilNEA merged commit 40f28aa into master May 31, 2026
6 checks passed
@AprilNEA AprilNEA deleted the feat/tray-dynamic-policy branch May 31, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant