MacOS Statusbar App Input from Keyboard goes wrong

I have an StatusBar APP in Swift, under Sonoma the App works fine, after upgrade to Sequoia, i cant get the input from Keyboard inside the NSTextField, because the NSTextField shows the Focusring.

The given input from keyboard, get every time to another window, like xcode, Safari or Desktop.

depending on what was last active after I selected a menu item in the menu of the statusbar APP with a view or an NSAlert with an NSTextField.

I have spent several hours with debug sessions, a KeyDown or KeyUP event from the keyboard does not arrive.

As I said in Sonoma this was not a problem and the APP works as expected. To me this looks like a bug in Sequoia.

But maybe someone here has an idea on this topic

Answered by fbr in 810651022

I found out the following. In the appDelegate class, I created the variable statusItem with let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)

in the method func applicationDidFinishLaunching(_ notification: Notification) I have setup the statusItem with entries.

Now that I have only added the variable statusItem with: var statusItem: NSStatusItem? and only declared it in the method func applicationDidFinishLaunching(_ notification: Notification) with statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) there are no more problems with the keyboard responder and its events.

Maybe it helps one or the other.

Accepted Answer

I found out the following. In the appDelegate class, I created the variable statusItem with let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)

in the method func applicationDidFinishLaunching(_ notification: Notification) I have setup the statusItem with entries.

Now that I have only added the variable statusItem with: var statusItem: NSStatusItem? and only declared it in the method func applicationDidFinishLaunching(_ notification: Notification) with statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) there are no more problems with the keyboard responder and its events.

Maybe it helps one or the other.

MacOS Statusbar App Input from Keyboard goes wrong
 
 
Q