I could swear I’ve read about this before somewhere, but now I can’t find it.
Here’s an experiment you can do with the default layout.
Type a }
(fn+i) and then a [
(fn+o). The result? }[
as expected.
Now, press and hold fn+i. While holding, press fn+o. The result? }{
! Not }[
as one would expect (since holding a
and pressing b
results in ab
).
Why does this happen? Because there is no }
key in the en-US QWERTY layout. What the firmware does is first sending shift down
directly followed by ] down
(which results in a }
being typed), and then shift up
followed by ] up
when releasing the key.
So when you hold fn+i (“the }
key”) the OS thinks that the shift key is held. So when you press fn+o (“the [
key”), the OS shifts it into {
.
Is this a problem? Not really, I’d say. I don’t think people type a }
followed by a [
very often. Because that’s when a problem could arise. Many times when typing two characters quickly after each other, you actually press the second key before releasing the first. In other words, holding the first key while hitting the second.
So why do I bring this up? I’ve been experimenting with ditching my custom XKB (Linux keyboard layout thing) layout in favor of using the awesome Kaleidoscope firmware as much as possible instead.
I type mostly in English, and that works really well. Occasionally, I type in Swedish. This requires three more letters: å, ä and ö. To get those, I use the international en-US QWERTY layout in my OS, which allows typing for example altgr+q to get an ä. But I don’t want to hold altgr when typing those letters. So I’ve made a key that’s bound to RALT(Key_Q)
. Nice.
The problem arises when I want to write the word “är” which means “is”. A pretty common word, that is. Guess what happens when I write that quickly? I get “äë”, because altgr+r gives an ë.
Finally, on to the actual questions:
- Is the
}[
→}{
thing considered a bug? - Is there anything that could potentially be done about this?
- If so, would it be crazy hard?
- Could somebody point me out where I could potentially start poking in the firmware to deal with this? I’m no good at c++ but I can be quite stubborn…
- Or could this be done in my layout without changes to the core (for now)?
- Does anyone else want this?
- Or should I just go back to my custom XKB layout again?
One way I imagine the firmware could deal with this is instead of just sending right alt up
and right alt down
along with the actual key for RALT(…)
, it would also set a flag such as synthetic_right_alt_down_sent
. Then, when pressing any other key it would check if synthetic_right_alt_down_sent
is set and send a right alt up
first. Same thing for LSHIFT(…)
and all other modifiers.
Thanks for reading
(You can find all custom keys I use here: https://github.com/lydell/Model01-Firmware/blob/master/key_defs_custom.h)