I have a NSMenuItem that has a keyboard shortcut. I set the shortcut like this:
// Close
let closeItem = NSMenuItem()
closeItem.title = Resources.QUIT
closeItem.action = #selector(quit)
closeItem.keyEquivalentModifierMask = [NSCommandKeyMask]
closeItem.keyEquivalent = "Q"
self.menu.addItem(closeItem)
Unfortunately, I can not get rid of the "Shift" key:
What is the problem with my code?
The solution was pretty easy: Instead of using "Q", I used "q" and the shift modifier was gone. The new code:
self.menu.addItem(NSMenuItem(title: Resources.QUIT, action: #selector(quit), keyEquivalent: "q"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With