I’m trying to map a key from the key cluster to act as a “super” key (which is working), but at the same time, I want it to shift to the Mod layer so I can use the arrow keys.
On my mac keyboard, I have the caps lock key mapped to LShift+LCtrl+LOption+LCmd, then I use the arrow keys to move my windows.
Right now on the UHK, I have press my custom key, then press another key to shift to the Mod layer, hold down those two keys and then use the arrows keys.
I tried by mapping it to the secondary role, but this just changes to the mod layer, without sending the modifiers.
Is there a way to do this, so that pressing one key sends the correct key code and switches temporarily to Mod layer; so I can mimic the native functionality I have on the mac keyboard?
Thank you for the hint, but how do I find out what is the key code for the (the iLG) for the key I want to map? If I use the macro editor and I press the button, it just shows me the scancodes it will send (LCtrl + LShift + LOption + LCmd).
Also the right pane in the Agent can be useful as it contains various interactive widgets, as well as links to the above documents for the exact firmware version that is flashed on your UHK
I think maybe I’m overthinking this. So do I have to worry about which physical key is struck on the keyboard first? Or do I code my macro, which includes the scan codes that will be sent (LCSGA), then map it to any key?
I thought the sequence was:
Find out the keycode of the physical key
Map that key press/hold/release to some action, this action can be a scan code, or a macro.
I understand now that with the macro, I can say if this key is pressed and held, then, switch to mod layer, and then send LCSGA across, once the key is released, revert back to the previous layer.
I think because I am mapping it to a key in the key cluster - those keys aren’t standard keys so its like a blank button, and I can tell it when this physical button is pressed is that the correct approach?
By mapping the key to the macro, you bind it to the physical keypress. So when that key is pressed down, the macro starts to execute. Within the macro you can then either just do something quickly, or wait for physical release of the key and have some more actions after the key has been released.
pressKey is a bit of a misnomer. More precise would be startSendingScancode.
As said, you just bind it to a key. Then press the key which starts the macro. That adds the four mods to the usb report, then activates layer for as long as you hold the key…
In addition to what @kareltucek already said, it is helpful to know that all scancodes that were “pressed” by a macro are automatically released when the macro ends.