Skip to content

Preserve frontmost app focus for chat overlay - #2

Open
pankaj-raikar wants to merge 2 commits into
rbc33:mainfrom
pankaj-raikar:fix/non-activating-chat-window
Open

Preserve frontmost app focus for chat overlay#2
pankaj-raikar wants to merge 2 commits into
rbc33:mainfrom
pankaj-raikar:fix/non-activating-chat-window

Conversation

@pankaj-raikar

@pankaj-raikar pankaj-raikar commented Aug 13, 2026

Copy link
Copy Markdown
Screen.Recording.2026-08-13.at.9.29.29.AM.mp4

Summary

  • Convert the chat window to a non-activating panel
  • Prevent Ghostbar from activating itself when showing the chat overlay or status-bar menu
  • Keep the model dropdown interactive without changing the active application

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

  • [0/1] Planning build
    Building for debugging...
    [0/3] Write swift-version--58304C5D6DBC2206.txt
    Build complete! (0.13s)
  • [x]
  • Manually verified with another application frontmost
  • Confirmed typing works in Ghostbar without changing the active app
  • Confirmed the model dropdown remains interactive
  • Confirmed dismissing the overlay returns interaction cleanly to the previous app

Demo

A screen recording demonstrating the behavior will be attached to this pull request.

- 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
Copilot AI lite review requested due to automatic review settings August 13, 2026 04:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 NSPanel that 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 thread Sources/Ghostbar/UI/MovableWindow.swift Outdated
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.
Comment thread Sources/Ghostbar/UI/ChatWindow.swift Outdated
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
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.

2 participants