When running in macOS it breaks the F1-F12 row
TheMasterDingo opened this issue · 7 comments
I got a new MBP M3 and decided to install keymapper here aswell.
Installed the karabiner-virtualHIDDevice then keymapper through brew.
I did not notice at first but the F1-F12 row(which contains also volume, media keys, brightness, etc) did not work.
I tested the keys on https://www.toptal.com/developers/keycode and i saw that it sees only F1-F12.
Basically it does not send the 'special keys'. There is also an option in macOS that it deafualts to the F1-F12 row but i made sure it is disabled, hitting fn key and the F1-F12 row does still not send the other keys.
If i disable keymapper everything works well.
I'm just guessing here, I don't own a Mac, but I perhaps this is what's happening:
- keymapper registers itself as a virtual input device that the OS handles like any attached external input device
- keymapper grabs input events from other input devices on a low level which keymapper just passes through if not mapped to anything
- regardless of the OS level setting, MBP keyboard produces the same key codes for the F-row keys
- keymapper grabs key events, then passes them through unmodified as if pressed by the generic virtual keyboard it creates
- the F-key behavior is handled by the OS application level and only affects key events coming from the integrated keyboard (or perhaps any Apple keyboard), so key events passed through by keymapper get ignored
If the above is correct, you could try mapping the F-key codes manually to their special functions in the beginning of the config. This could be done with just 2 lines of config If the Fn
key on the keyboard sends a keycode keymapper can see*. Example:
FunctionKey = F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12
FunctionKey >> Fn{FunctionKey}
*) In Key.h
there at least seems to be a mapping for Fn
key:
Line 439 in 5250c94
If this fails, then map the F-keys to the special keycodes one by one, e.g.:
F1 >> BrightnessDown
F2 >> BrightnessUp
# etc
You'll find all the supported key names in src/runtime/Key.h.
If my suggestion above works, it gives the flexibility of handling the F-key behavior differently depending on the app. If for example you want them work as special keys by default but have use for F1-F12
on a code editor, you can add a context block first that targets the code editor, then add those mappings in the end of the config. Something like:
FunctionKey = F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12
[class="Code"]
FunctionKey >> FunctionKey
[default]
FunctionKey >> Fn{FunctionKey}
I just tried both methods but it does not work.
When i tried the Fn key in https://www.toptal.com/developers/keycode it sees nothing.
Even if i do a manual F1 >> BrightnessDown it does not work
Have you tried how Karabiner EventViewer shows the keypresses https://karabiner-elements.pqrs.org/docs/manual/operation/eventviewer/? Note that I'm literally googling, I have no clue what the issue could be. 🙂
Or does the Fn
key event show up in https://www.toptal.com/developers/keycode when keymapper is not running?
Hm no i haven't tried Karabiner EventViewer.
the toptal website does not see the Fn key at all, with or without keymapper running.
(even when using this https://www.hexcore.xyz/kbdtool it does not see the Fn)
Thanks for reporting. I will test it soon on a recent Apple device myself. Hopefully I can reproduce it.
This should be fixed with the 4.1.2 release.