Inspired by this article, I decided to program my M01 to only allow me to type shifted alphanumeric keys on the left side if the right shift key is pressed, and vice versa.
I got it working by defining two new layers, appropriately named SHIFT_LEFT and SHIFT_RIGHT. The former has only the left half defined (with the right half being filled with XXX), and the latter is the opposite. Shifting is accomplished by using the LSHIFT() macro on all the keys.
This solution has a few bugs, though, and before I go about fixing them, I’m curious if there’s a better way. I considered making a simple plugin that basically disables keypresses on one half of the keyboard while that half’s shift key is pressed, but I’m not sure if this is possible in a plugin (let alone how to actually go about doing it, though I’m willing to learn).
(Obviously I could just install the software in that post, but I always like to avoid installing new software if I can.)
It’d be fairly simple to write a plugin to do this. You’d basically watch for key press events on Shift and set a boolean flag to disable the opposite half. You’d disable the flag on Shift key release events. The other part of the plugin then would be to watch all non-shift key press events and block those events (return false) for the other half of the keyboard. You can tell which row and column where pressed in the keypress handler, so it’s trivial to do that by the column of the pressed key.
So, I’ve got the plugin written, and it seems to build, but I’m not sure how/where to put the files so that my Model01-Firmware.ino can find them. I tried linking the directory into hardware/keyboardio/avr/libraries, but that didn’t work.
You’ll have to turn them into an Arduino Library, and make that library available for Arduino. Putting them into a hardware/keyboardio/avr/libraries is on the right path: you need to name your plugin, create a subdirectory there with that name, create a library.properties file (copy one from the existing plugins and modify it, it’s a trivial format), put your source files under the src/ directory of the plugin directory.
Then it should be accessible for Arduino.
If you need further help, let me know. If you can share your current sketch, I can walk you through extracting the plugin files into a proper plugin, in its own repo.
hmm, would you be able to do something similar in splitting the left and right function keys? i’ve been thinking about splitting the keyboard’s function … function to be local to the side of the board where it is pressed (since i usually use the base of my thumb on the modified side anyway, and this allows a few other chords to be more easily accessible.
You can map one of the Fn keys to ShiftToLayer(SOME_LAYER), and the other to ShiftToLayer(ANOTHER_LAYER), and voila! (I’m doing something similar - well, the same, only with OneShot layers -, and it works like a charm.)