Skip to content

Keep Ask Omi from surfacing the main window#5632

Merged
kodjima33 merged 1 commit intomainfrom
codex/fix-ask-omi-main-window-focus
Mar 14, 2026
Merged

Keep Ask Omi from surfacing the main window#5632
kodjima33 merged 1 commit intomainfrom
codex/fix-ask-omi-main-window-focus

Conversation

@kodjima33
Copy link
Collaborator

Summary

  • make the floating bar a non-activating panel instead of a regular window
  • keep Ask Omi focus on the floating bar without surfacing the main Omi window
  • preserve text-input focus behavior for the floating bar shortcut flow

Testing

  • xcrun swift build -c debug --package-path desktop/Desktop
  • launched isolated app bundle /Applications/Omi Shortcut Focus Test.app
  • verified through full-screen UI screenshots that after ⌘ Enter, the foreground app stayed visible and only the floating bar appeared on top
  • evidence: /tmp/omi-shortcut-full-before.png and /tmp/omi-shortcut-full-after.png

@kodjima33 kodjima33 merged commit 59bcf4c into main Mar 14, 2026
2 checks passed
@kodjima33 kodjima33 deleted the codex/fix-ask-omi-main-window-focus branch March 14, 2026 19:59
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 14, 2026

Greptile Summary

Converts the floating control bar from an NSWindow to a non-activating NSPanel so that the Ask Omi shortcut can focus the floating bar for text input without pulling the main Omi window to the foreground.

  • Changed FloatingControlBarWindow superclass from NSWindow to NSPanel and added .nonactivatingPanel to the style mask
  • Set canBecomeMain to false (panels should not be main windows) while keeping canBecomeKey as true (needed for text input)
  • Removed the explicit NSRunningApplication.current.activate() call in openAIInput(), as the non-activating panel handles focus correctly on its own
  • No impact on the windowDidResignKey dismiss behavior — the panel still becomes key and fires resign notifications as expected

Confidence Score: 5/5

  • This PR is safe to merge — it uses a standard macOS pattern for utility panels and the changes are minimal and well-scoped.
  • Single-file change using a well-established macOS API pattern (NSPanel with .nonactivatingPanel). NSPanel is a subclass of NSWindow so no downstream casts or type checks break. The remaining code paths (windowDidResignKey, makeKeyAndOrderFront, focusInputField) all work correctly with non-activating panels. The PR was tested against the full shortcut flow.
  • No files require special attention

Important Files Changed

Filename Overview
desktop/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift Converts FloatingControlBarWindow from NSWindow to NSPanel with .nonactivatingPanel style, sets canBecomeMain to false, and removes the explicit app activation call in openAIInput(). This is a well-established macOS pattern for utility panels that need keyboard input without activating the app.

Sequence Diagram

sequenceDiagram
    participant User
    participant GlobalShortcutManager
    participant FloatingControlBarManager
    participant FloatingControlBarWindow as FloatingControlBarWindow (NSPanel)
    participant MainWindow

    User->>GlobalShortcutManager: ⌘ Enter (Ask Omi shortcut)
    GlobalShortcutManager->>FloatingControlBarManager: toggleAIInput()
    FloatingControlBarManager->>FloatingControlBarWindow: openAIInput()
    Note over FloatingControlBarWindow: Non-activating panel becomes key<br/>without activating the app process
    FloatingControlBarWindow->>FloatingControlBarWindow: showAIConversation()
    FloatingControlBarWindow->>FloatingControlBarWindow: makeKeyAndOrderFront(nil)
    Note over MainWindow: Main window stays behind<br/>foreground app unchanged
    FloatingControlBarWindow->>User: Floating bar accepts keyboard input
Loading

Last reviewed commit: 8f5913f

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