1

I have my UIElement set to YES in Info.plist. Then I registered a hotkey. When it's pressed, it calls a NSWindowController object and shows a window.

But I must call NSApp.activate(ignoringOtherApps: true) after mainWindowController.showWindow(self) , causing any other windows blur.

I want to create a window that does not change other window's status but can focus on (or receive local keyboard events), like what Alfred or Spotlight does.

Screenshot 1
When Alfred is called out, Chrome does not blur. When I hit my keyboard, I typed in Alfred instead of Chrome's input field.

Screenshot 2
When I press [ESC], Alfred hides. Chrome keeps activated and the text field is still focused on.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
Balthild Ires
  • 31
  • 2
  • 5
  • What is your NSWindow's [style mask](https://developer.apple.com/documentation/appkit/nswindow.stylemask)? – zneak Sep 12 '17 at 15:42
  • 5
    Possible duplicate of [How to show a window without stealing focus on macOS?](https://stackoverflow.com/questions/46023769/how-to-show-a-window-without-stealing-focus-on-macos) – Charles Srstka Sep 12 '17 at 15:42
  • Yes, that's what I'm looking for, thank you. This can be marked as duplicated. – Balthild Ires Sep 12 '17 at 15:53

0 Answers0