Hi. So I have my keyboard attached to a USB switch and I have a script on each machine that fires when I switch the keyboard to that machine. The script uses switch-keymap.ts to change the keymap and this all works fine.
But as soon as I change the layer, say hitting the mod key, the keyboard reverts to the default layout.
However, I’ve discovered that if I use exec-macro-command.ts "switchKeymap {keymapId}" then this doesn’t happen and the keymap change persists correctly.
So while I now do have things working the way I want, I was wondering what the deal is with switch-keymap.ts ?
To be precise the problem is that keymap gets switched back to previous keymap upon using a holdLayer ... macro. The reason is the mechanism that allows switching to layers of other keymaps (holdKeymapLayer ...) - after a regular keymap switch, the layer stack has to be resetted. Otherwise, the previous keymap remains in the base of the stack and will trigger a layer switch when the holdLayer command is released. This reset was missing in the usb command firmware code.