Preserve frontmost app focus for chat overlay - #2
Open
pankaj-raikar wants to merge 2 commits into
Open
Conversation
- Convert the chat window to a non-activating panel - Remove explicit application activation when showing chat and menus - Keep the model dropdown non-activating and interactive
There was a problem hiding this comment.
Pull request overview
This PR adjusts Ghostbar’s macOS windowing behavior to keep the current frontmost application active while Ghostbar shows its chat overlay and related UI, reducing focus-stealing.
Changes:
- Convert the chat overlay window to a non-activating
NSPanelthat can still become key for input. - Avoid activating Ghostbar when showing the chat overlay and when opening the status-bar menu.
- Update the private dropdown panel to be non-activating and avoid activating Ghostbar when shown.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Sources/Ghostbar/UI/PrivateDropdown.swift | Makes the dropdown panel non-activating and shows it without activating the app. |
| Sources/Ghostbar/UI/MovableWindow.swift | Changes the overlay window base class to NSPanel and allows it to become key. |
| Sources/Ghostbar/UI/ChatWindow.swift | Uses a non-activating floating panel and shows it without activating Ghostbar. |
| Sources/Ghostbar/App/AppDelegate.swift | Stops activating the app when the status-bar menu opens. |
Suppressed comments (1)
Sources/Ghostbar/UI/ChatWindow.swift:56
- The comment refers to “App X”, which is ambiguous. Reword to refer to the current frontmost/active application to make the focus behavior clear.
// Show above other apps and become the keyboard target WITHOUT activating
// Ghostbar — App X stays the frontmost/active application.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+7
to
+9
| // Become the keyboard target so the user can type into the overlay, without | ||
| // making Ghostbar the active application. canBecomeMain stays false (NSPanel | ||
| // default) so App X keeps ownership of the menu bar / frontmost status. |
| window.standardWindowButton(.zoomButton)?.isHidden = true | ||
| window.level = .floating | ||
| window.isFloatingPanel = true | ||
| window.hidesOnDeactivate = false // keep overlay visible while App X is active |
- Remove explanatory comments added with the focus-preservation update\n- Keep the implementation aligned with the repository's existing style
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.
Screen.Recording.2026-08-13.at.9.29.29.AM.mp4
Summary
Motivation
When Ghostbar was opened or clicked, it could pull focus away from the application the user was working in. This change keeps that application frontmost while allowing the overlay to remain visible and accept keyboard input.
Testing
Building for debugging...
[0/3] Write swift-version--58304C5D6DBC2206.txt
Build complete! (0.13s)
Demo
A screen recording demonstrating the behavior will be attached to this pull request.