| index.md - sites - public wiki contents of suckless.org | |
| git clone git://git.suckless.org/sites | |
| Log | |
| Files | |
| Refs | |
| --- | |
| index.md (1604B) | |
| --- | |
| 1 keysequence | |
| 2 =========== | |
| 3 | |
| 4 Description | |
| 5 ----------- | |
| 6 | |
| 7 This patch allows for defining sequential keybindings, for example `MOD+… | |
| 8 This is done not through the `XGrabKey()` which is used for root binding… | |
| 9 but by the `XGrabKeyboard()` so any key presses that are not defined will | |
| 10 stop the matching without passing them to programs. This behaviour is | |
| 11 less confusing. | |
| 12 | |
| 13 It defines new bindable function `keypress_other()` that as argument tak… | |
| 14 a pointer to array of bindings. | |
| 15 | |
| 16 static Key keyseq_a[] = { | |
| 17 { 0, XK_t, setlayout, {.v = &la… | |
| 18 { ShiftMask, XK_t, setlayout, {.v = &la… | |
| 19 { MODKEY, XK_y, setlayout, {.v … | |
| 20 {0} | |
| 21 } | |
| 22 | |
| 23 static Key keys[] = { | |
| 24 { MODKEY, XK_a, keypress_other, {.v = keyseq_a}}, | |
| 25 {0} | |
| 26 } | |
| 27 | |
| 28 This assigns `MOD+a t`, `MOD+a T`, `MOD+a MOD+y` to changing layout, you… | |
| 29 nest bindings endlessly. | |
| 30 | |
| 31 Notice that now keybinding arrays are ended by `{0}` empty element, | |
| 32 this is necessary because `Arg` structure can take only pointer | |
| 33 sized elements, there's no place to specify size so it has to be | |
| 34 calculated while running. | |
| 35 | |
| 36 While typing sequence all events are ignored other than key presses | |
| 37 and mouse, moving mouse exits sequence. | |
| 38 | |
| 39 Save your hands! Don't make long sequences, stick to simple, easy to | |
| 40 access binding and use plain letters, realistically speaking you'll | |
| 41 use it for dmenu scripts, layout bindings, and other rarely used | |
| 42 commands. | |
| 43 | |
| 44 Download | |
| 45 -------- | |
| 46 * [keysequence-20250606-0d6af14.diff](keysequence-20250606-0d6af14.diff) | |
| 47 | |
| 48 Author | |
| 49 ------ | |
| 50 * TUVIMEN <[email protected]> |