When does setup() run? Specifically, will setup() run while the computer is being used, if the computer sleeps, the user logs out, the computer restarts, the computer shuts down, if the cable is unplugged, or when?
I would like to be able to have Keyboardio be QWERTY when someone unplugs it and plugs it back in, but to stay COLEMAK after I change it to COLEMAK. Right now it’s set up so I can switch to QWERTY and back again using leader key sequences, but COLEMAK is the default. I’m thinking about how the keyboard can be easy for other people to use on occasion. It seems like the best way for that to work is to say “I use a different keyboard layout, just plug unplug it and plug it back in and it will work the way you expect it to;” or “plug it in to your laptop and try it out.”
setup() runs whenever the keyboard “boots”, which usually happens when you plug it in, or after you’ve reset it. It does not run when the computer resumes from sleep, nor when the user logs out (unless logging out cuts power from the keyboard). Restarting the computer, shutting it down, plugging the cable out all cut power, and setup() will run when you turn the computer on or plug the cable back in.
So if you default to QWERTY, but change to COLEMAK with a Leader sequence, it will stay in COLEMAK until you reboot your computer or re-plug your keyboard (in which cases, it will go back to the default QWERTY).
My set up is a bit of a mess. I’m going to re-install the latest standard Keyboardio firmware and set everything up the way I like it again, but in a neater and more organized way this time. There isn’t a major upgrade coming up really soon, is there? If that were the case I might want to wait—but no more than a few weeks.
There are going to be some big changes coming soon-ish, to the MagicCombos, Focus and EEPROM-Settings plugins. If you aren’t using those, there’s no reason to wait. If you are, migration will be quite easy too.