0

currently I'm using activate and makeKeyAndOrderFront to "show" and focus a TextEditor on my NSPanel when I pressing a hotkey. However this steals the input focus from other apps. How should I go about also maintaining the input focus from background apps so when close the nspanel, the key focus resumes on the background app?

activate(ignoringOtherApps: true) panel?.makeKeyAndOrderFront(panel)

I tried just calling makeKeyAndOrderFront but my TextEditor won't focus for some reason. There are other apps like Raycast that does this perfectly, as seen from the screenshot below.

my NSPanel is pretty basic https://pastebin.com/3QtQ1xe4

Any help would be much appreciated!

I tried removing activate(ignoringOtherApps: true) but that doesn't focus the TextEditor on my NSPanel.

  • It is still not clear what you want to achieve: 1. show NSPanel without focus or 2. show NSPanel with focus and return focus to last window when done. – soundflix Aug 22 '23 at 19:38

0 Answers0