-
Hi! I’d like to generate custom key codes on macos for the spot light, dictation and do not disturb keys that have to be explicitly dealt with in the kanata configuration. The community has already identified the codes:
reference: https://www.usb.org/sites/default/files/hut1_4.pdf Is there a way to define a key to emit those code in my kanata config? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
There isn't a way without modifying some code and recompiling yourself. You would need to add an OsCode mapping in this file: kanata/parser/src/keys/macos.rs Line 624 in 1605713 You can pick an arbitrary unused OsCode if there isn't And then you would add a name for it: Line 342 in 1605713 Or otherwise use |
Beta Was this translation helpful? Give feedback.
-
thanks, I’ll give it a try! |
Beta Was this translation helpful? Give feedback.
-
It (mostly) works! Apparently I didn’t find the right key code for Do Not Disturb. Is there a way to read the keycode when I press a key on macos? |
Beta Was this translation helpful? Give feedback.
There isn't a way without modifying some code and recompiling yourself.
You would need to add an OsCode mapping in this file:
kanata/parser/src/keys/macos.rs
Line 624 in 1605713
You can pick an arbitrary unused OsCode if there isn't
And then you would add a name for it:
kanata/parser/src/keys/mod.rs
Line 342 in 1605713
Or otherwise use
arbitrary-code
ordeflocalkeys
to name it in the configuration. But probably better to add a name in the code if you're already modifying.