From dd5b61ee6d7514ac13eb8f5b24e5f345b88a5fc5 Mon Sep 17 00:00:00 2001 From: Milan Hoppe Date: Fri, 3 Jul 2026 04:44:25 +0200 Subject: [PATCH] Fix search field not visibly taking focus when search window opens The search window is opened from a global hotkey while another app is active. App activation is asynchronous on modern macOS, so the makeFirstResponder: call in showSearchWindow ran before the window could become key: typing reached the field, but no caret appeared and the field looked unfocused. Focus the field from windowDidBecomeKey: instead, once the window has actually taken key status. Co-Authored-By: Claude Fable 5 --- AppController.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AppController.m b/AppController.m index 3898ab0..a204eaa 100755 --- a/AppController.m +++ b/AppController.m @@ -935,6 +935,17 @@ - (void)windowDidResignKey:(NSNotification *)notification { [self hideApp]; } +- (void)windowDidBecomeKey:(NSNotification *)notification { + // The search window is opened from a global hotkey while another app is + // active, and app activation is asynchronous on modern macOS. A + // makeFirstResponder: call at show time runs before the window can take + // focus, so the field accepts keystrokes but never shows its caret. + // Focus the field once the window has actually become key. + if ( [notification object] == searchWindow ) { + [searchWindow makeFirstResponder:searchWindowSearchField]; + } +} + -(void)fakeKey:(NSNumber*) keyCode withCommandFlag:(BOOL) setFlag /*" +fakeKey synthesizes keyboard events. "*/ {