The new $onJoin and $onSplit macro events have some nice usecasesā¦
Thanks to @euan.buchanan for the idea to use the merge sensor for macro actions. I was going to say that canāt believe it wasnāt suggested a long time ago, but while troubleshooting, I saw this GitHub issue from a couple years ago.
And of course, thanks to @maexxx & @kareltucek for their brains.
Hereās some examples for locking/sleeping the UHK by joining the halves together:
AFUHK Mode
I use this if Iāll be Away-From-UHK for a while.
(I also mutter something kinda like āAFUHKā under my breath when I find myself typing on a non-UHK board. )
The following will disable BLE/advertising, put the PC to sleep, and lock the UHK80:
$onJoin
set bluetooth.alwaysAdvertiseHid 0
set bluetooth.enabled 0
tapKey systemSleep
powerMode lock
And then this will wake the UHK80 when separating the halves:
$onSplit
delayUntil 3000
powerMode wake
If youāll be transporting the UHK80 (AWUHK Mode āAway With UHKā ), and want to put it to sleep instead of just locking it, then replace
powerMode lock
with powerMode sleep
in the $onJoin event. Of course, if you use sleep mode, youāll have to manually wake the halves by holding the S+F & J+L keys, instead of using the $onSplit macro in the above example.
Itās also probably a good idea to note that (depending on the merged/unmerged state) the $onJoin or $onSplit macro events will be triggered when the UHK is restarted. E.g., if you have tapKey systemSleep
in the $onJoin event, it will put the host to sleep if the halves are merged when the UHK80 reboots (whether from a crash, or if the reset buttons on the back are pressed, etc.).