HotKey
HotKey copied to clipboard
Unable to capture fn key
Setup
macOS: 11.0.1 HotKey: 0.1.3 Deployment Target: 10.15 XCode Version: 12.3
Issue
I seem to be unable to capture the fn
key with HotKey when looking at the modifierFlags
.
let carbonKey = UInt32(event.keyCode)
let carbonFlags = event.modifierFlags.carbonFlags
self.hotKey = HotKey(keyCombo: KeyCombo(
carbonKeyCode: carbonKey,
carbonModifiers: carbonFlags
))
I also tried passing the modifierFlags
directly:
let carbonKey = UInt32(event.keyCode)
self.hotKey = HotKey(keyCombo: KeyCombo(
key: Key(carbonKeyCode: carbonKey)!,
modifiers: event.modifierFlags
))
When recording a shortcut with the fn
pressed, it seems to omit fn
from what is stored.
Executing the recorded shortcut with fn
pressed also does not activate the shortcut (it does work when omitting fn
key).
When describing the stored shortcut, the fn
key, it is absent:
self.hotKey?.keyCombo.description
However, performing the following check prior to storage indicates that the fn
key is indeed present
if (event.modifierFlags.contains(.function)) {
// this evaluates to true
}
Is there anything I'm missing? Is this unsupported?
Same issue here. A workaround would be appreciated if anyone finds one.
I tried using this to capture Fn+Space (I bought a new keyboard that has a "Microphone" key that sends that combo.) and similarly wasn't able to:
let hotKey = HotKey(key: .space, modifiers: [.function])