index.md - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       index.md (3089B)
       ---
            1 keymodes
            2 ========
            3 
            4 Description
            5 -----------
            6 This patch provides key modes (like in Vim). There are two key modes:
            7 
            8 1. `COMMANDMODE`: In this mode any key is grabbed and only the registered
            9    command keys have any effect.
           10 2. `INSERTMODE`: This is the normal key mode, in which the original key
           11    bindings of dwm and applications are effective and text can be entered.
           12 
           13 With key modes you can use any key binding for window management without
           14 risking conflicts with existing key bindings in applications or have a
           15 Vim-style dwm.
           16 
           17 There are two different patches:
           18 
           19 * keymodes: the minimal patch
           20 * vim-keymodes: This patch tries to emulate the key bindings of Vim. Therefor
           21    it includes additional functions, which depend on the
           22    [flextile patch](../flextile/).
           23 
           24 Configuration
           25 -------------
           26 1. Download the favoured patch and apply it according to the
           27    [general instructions](.). If you choose vim-keymodes you will have to apply
           28    the [flextile patch](../flextile/) first.
           29 2. Transfer the changes made by the patch in `config.def.h` to your `config.h`,
           30    if needed; please see the patch file for details.
           31 3. Verify the following lines in the aforementioned arrays; the key bindings
           32    are set in reference to a german keyboard layout. The entries in the `cmdkeys`
           33    array are defined like those in the original `keys` array of dwm and take
           34    precedence over the key bindings defined in the `commands` array. The modifier
           35    and keysym definitions in the `commands` array are themselves arrays with four
           36    entries, whereas the first entry in the modifier array corresponds to the first
           37    entry in the keysym array and so forth. You can find an example configuration
           38    [here][dwm-keymodes-vim-config.h].
           39 
           40         static Key keys[] = {
           41                 /* modifier             key                 function       argument */
           42                 { MODKEY,               XK_Escape,          setkeymode,    {.ui = COMMANDMODE} },
           43 
           44         static Key cmdkeys[] = {
           45                 /* modifier             keys                function       argument */
           46                 { 0,                    XK_Escape,          clearcmd,      {0} },
           47                 { ControlMask,          XK_c,               clearcmd,      {0} },
           48                 { 0,                    XK_i,               setkeymode,    {.ui = INSERTMODE} },
           49         };
           50         static Command commands[] = {
           51                 /* modifier (4 keys)    keysyms (4 keys)    function       argument */
           52                 ...
           53         };
           54 
           55 Usage
           56 -----
           57 With this patch dwm starts in `COMMANDMODE` and you can use the key bindings as
           58 defined in the `commands` array in `config.h`. Press `Escape` or `CTRL+c` to
           59 abort a command input and press `i` (in the default configuration) to enter
           60 `INSERTMODE` and use dwm normally with the key bindings defined in the `keys`
           61 array, navigate in applications and insert text. To get from `INSERTMODE` to
           62 `COMMANDMODE` press `ALT+Escape` (in the default configuration).
           63 
           64 Download
           65 --------
           66 * [dwm-keymodes-5.8.2.diff](dwm-keymodes-5.8.2.diff) (20100611, joten (at) freenet (dot) de)
           67 * [dwm-keymodes-vim-5.8.2.diff](dwm-keymodes-vim-5.8.2.diff) (20100611, joten (at) freenet (dot) de)
           68 * [dwm-keymodes-20220422.diff](dwm-keymodes-20220422.diff) (michael@ndrix.org)