implementing keyboard primitives
Table of Contents
1. Implementing keyboard primitives
In some softwares, modifier-key shortcut or single key shortcut is implemented, like in Krita
, pressing b
will change your tool type
to brush
, while in Xournalpp
, similar shortcut is Ctrl-Shift-P
.
1.1. modifier keys
commonly, Ctrl, Alt, Win, Super, Hyper, Option
are used as modifier keys. There may be more with specific software
Modifier keys are usually pressed with at least one non-modifier key to form a keybinding, which would be bind to some privimitve, such as “switch focus to window left” could be called with Super-Shift-h
if you have bindsym $mod+Shift+h move left
in your ~/.config/i3/config
.
1.2. key sequence
There’s only about 40 or so keys on the keyboard, to bind more primitives to the keyboard, one can use different combos of modifier keys, such as shift+ctrl
, shift+super
, or in some software(emacs, vim), use key sequence, such as ctrl-x ctrl-c
The parse and design of key sequence follows similar restriction to hoffman code, namely, you can’t bind ctrl-x
to primitive if you have binded ctrl-x ctrl-c
to primitive.(if you do, nondeterministic parsing or ctrl-x ctrl-c
never be called would happen)
Backlinks
With all keys keyboard provide, 2 types of primitives are essential:
- navigation
- selecting an object to interact with
- interaction
- interact with an object(selected or predefined).
Initially, alphanumeric keys can only interact with a mouse-selected text area to insert some charactors, arrow keys can interact with current scrollble object, etc.