All sequences are belong to us
Here is how nearly countless shortcuts can be added to any device with buttons.
By simply allowing any sequence of input to be configured to perform any action, more can be done with fewer keys, faster. And, more comfortably: I apply this idea to solve Repetitive Strain Syndrome.
One can't find this level of flexibility on any keyboard today. This page shares how sequences can be useful, and how to make them possible with some Rust code.
The basics
The most basic sequences are combinations using two keys,
like pushing a modifier like Ctrl
and a letter,
but with all restrictions lifted.
There are no keys that can't be used to form a combo,
and no keys that have to be used.
And you can totally make use of the ordering
of events.
This can be applied to keyboards of any size to unlock a new category of shortcuts. As an example, 10 keys work as a practical replacement of a full QWERTY board, as shown in this interactive WASM application . This design strives for simplicity, and does not require the user to memorize an entirely novel mapping. Another implementation shows how it also puts emphasis on comfort.
Grid
It's easier to reason about the possible combinations by laying them out in columns and rows. The visualization also allows us to make an intuitive connection to the classic QWERTY layout.
With one key under each finger,
there are 10×9÷2=45
ways to pick two out of ten.
But for comfort, it's beneficial to have one hand
only press one key at a time;
each hand pressing one out of five keys produces
25
combinations.
These combinations are partly useful. A 5 by 5 grid covers half of the QWERTY layout, and keeps its arrangement.
To type a letter, first simply pick a column, using the same finger one would use with a QWERTY keyboard.
For example, to type the letter V, in the fourth column,
first
push the 4th key/finger (the left index finger).
The rows are mapped to the other hand.
For letter V, finger 6, the right thumb, should be used.
One can recall which two keys should be used together, by summoning up this image.
The other half
Similarly, we can type a letter on the right hand side.
Now selecting a column means
use a right hand finger first;
then, use the left
hand to select the row.
For instance,
press finger 7 (right index) followed by
finger 2 (left ring) for the number 7.
The two halves are distinguished by the order of presses, to type a letter on the left, use the left hand first; and vice versa.
It doubles what could have been done with only one 5 by 5 grid.
Order of key releases
We can go one step further, and once again double the number of possible combinations, to 100, without needing extra key strokes.
For instance, consider the combination involving pressing finger 3 first, followed by finger 6, the two can be released in two ways:
FIFO order, or first down first up order
That is releasing finger 3 first, the combination can be noted as
3,6,3,6
.One may use it for typing letter c.
First down last up order
Namely,
3,6,6,3
, release finger 6, then release finger 3.Something different can be configured to happen, like typing the letter
C
(in uppercase), or typingç
, or emulatingCtrl+C
.
Benefits
New forms of input devices are made possible. With only several keys(switches) required, portable inputs can be made small, without making keys tiny.
We can go in the other direction, for example, by making large buttons for arms, one can entirely avoid fatiguing fingers, Alternatively, the input device may not look like a keyboard at all, such as: arm-operated joysticks.
A portable version built with joysticks, similar to gaming controllers, is shown here.
One can make use of existing hardware: only software is needed to implement sequences on a touchscreen.
When using a full PC keyboard, here are some ideas for making additions that can be useful. For example, instead of pressing Ctrl+T for a new tab, hold N and tap T; instead of pressing Ctrl+Z to undo an action, hold U and tap D. This way, fingers don't need to make an effort to reach Ctrl, hopefully they can get more rest and less RSI.
But we can also do more with only ten keys, so large keyboards may not be as irreplaceable as they used to be.
Sequencing events
Combining two near-simultaneous taps we have the QWERTY covered with ten keys. But these combinations are only a special case of generalized sequences.
We can have three overlapping strokes in a sequence. They don't need to be all held down at the same time, a sequence is not broken as long as there's at least one key being pressed. So the first or second pressed key can be released before doing the third press. This reduces finger strain, and we can also make use of the ordering of events.
Exponential increase
A sequence is simply defined by a list of key press/release events, with a fully specified order.
Even with just ten keys, in three strokes, we get a very large number of possibilities:
- First press one key, out of 10
- Press one of the remaining 9
- then, either: press yet another one of the remaining 8,
- finally release the three pressed keys
- possibilities:
10×9×8×3×2×1=4320
- or, release one of the 2 pressed keys
- press one of the 9 keys (including one just released)
- finally release the 2 keys being pressed
- possibilities:
10×9×2×9×2×1=3240
A total of 4320+3240
unique sequences.
To take advantage of them, a good starting point is to pick sequences for memorability.
Acronyms or initialisms can be used to set up shortcuts for frequently typed words or commands.
For example, one can use the letters d, o, c as a shortcut for typing documentation. But unlike traditional auto-replace tools, it's triggered when and only when the keys are combined to form a sequence: both d and o are pressed at one point, and both o and c are pressed at one point. This way, one doesn't need to worry about context, you don't need to disable or enable the auto replacing depending on what application window is in focus.
Multiple shortcuts can be set up using the same keys, pressing c before o and d may be used to type code, for instance.
Sequences are applicable regardless of number of keys. Ten keys form plenty of sequences, by reusing the muscle memory developed on a keyboard, we can make them feel familiar, too. Think of the QWERTY layout as ten columns, to use a letter, just press a key depending on which column it's located in.
This is like the method used to remember telephone numbers, namely phonewords, which maps the alphabet to buttons on the keypad.
For instance,
to type else
,
recall the letters e, l, s
,
which are in the 3rd, 9th, 2nd
columns of the QWERTY layout.
So use fingers:
3 (left middle), 9 (right ring), 2 (left ring).
Press and release the keys in this sequence:
Press finger 3, press  finger 9, release finger 3,
press finger 2, release finger 9, release finger 2.
Or simply written as 3,9,3,2,9,2
.
To type main()
,
with m, a, i
in the 7th, 1st, and 8th QWERTY columns,
finger/keys pressed are, 7, 1, 8
, in order.
To type git 
(including space), with letters in the 5th and 8th columns,
press finger 5 (left thumb), followed finger 8 (right middle),
and then release finger 5 to press it again.
There are three presses, but only two keys.
More examples can be seen in the source code .
Implementation
The code is written as a rust library.
Run git clone https://enkode.info/kseqi_embedded.git
to get an example of building a binary
for ARM MCU (stm32f1).
The library is also compiled to web assembly and used in the browser-version .
Some other considerations
What do we lose by allowing arbitrary key combinations?
Traditionally a letter is typed when a key starts getting depressed, now the action takes place when releasing a key.
How to repeat an input?
Traditionally if one wants to type a character multiple times in a row, one would hold down that key, wait an appropriate amount of time, (and delete unneeded repetitions if necessary). The library introduced here always remembers the most recent action. After doing something for one time, such as typing a letter, or using an arrow key for navigation, or using a shortcut to type a whole word, a shortcut can be used to have the device repeat it a number of times more. For example, tapping number 7 while holding letter R, can be configured to repeat the last action seven times; hold R and tap 8 to repeat it eight times. Accuracy is easier to achieve this way and waiting is unnecessary.
Using the same keys for gaming
Key press/release events usually need to be transmitted immediately when playing a game, this can be accomplished by switching to a suitable mode .
Using existing shortcuts without a keyboard
Traditional shortcuts usually were designed with a PC keyboard in mind, requiring pressing dedicated modifier keys (Ctrl/Alt/Shift, etc.) and a letter at the same time; here sticky modifiers can help, they can be activated with keys or sequences, and will get combined with the next non-modifier input.
For the most frequently used the shortcuts, though, switching to sequences can be worthwhile.