feat(gui): dynamic Dock/menu-bar policy + start-minimized autostart#7
Merged
Conversation
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.
|
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.

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:
open_main_windowcallstray::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.on_window_closedobserver flips back oncecx.windows()is empty (any remaining window — Settings/About — keeps it Regular).Start-minimized autostart
--minimized, so a login-launched instance comes up in the tray with no window.open) — and every non-macOS platform, which has no tray — still open the window. Re-opening the running app routes through the existingon_reopenhandler.setActivationPolicy(Regular)indid_finish_launchingbefore ourrunclosure.Notes
tray::installno longer sets the policy;show_in_dock/hide_from_dockown it.cfg(target_os = "macos"); non-macOSstart_minimizedis alwaysfalse, so the window always opens.Verification
cargo fmt,cargo clippy --workspace --all-targets -- -D warnings, andcargo test -p openlogi-gui(incl. the plist--minimizedassertion) pass on macOS; Linux/clippy confirmed by this PR's CI.