sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 7b21d0b4a9fd0fbb249c5b56bfc6a5a60a7a73f6
parent facb144e30ba6345dfb42a8af98117c827047998
Author: joten <joten@freenet.de>
Date:   Fri, 11 Jun 2010 20:22:49 +0200

final edit for keymodes.md
Diffstat:
Adwm.suckless.org/patches/keymodes-5.8.2-vim-config.h | 163+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/keymodes.md | 7++++---
2 files changed, 167 insertions(+), 3 deletions(-)

diff --git a/dwm.suckless.org/patches/keymodes-5.8.2-vim-config.h b/dwm.suckless.org/patches/keymodes-5.8.2-vim-config.h @@ -0,0 +1,163 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const char font[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*"; +static const char normbordercolor[] = "#1f1f1f"; +static const char normbgcolor[] = "#1f1f1f"; +static const char normfgcolor[] = "#c0c0c0"; +static const char selbordercolor[] = "#ff8000"; +static const char selbgcolor[] = "#1f1f1f"; +static const char selfgcolor[] = "#ff8000"; +static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const Bool showbar = True; /* False means no bar */ +static const Bool topbar = True; /* False means bottom bar */ + +/* tagging */ +static const char *tags[] = { "1", "2", "3", "4", "5" }; + +/* include(s) depending on the tags array */ +#include "flextile.h" + +/* include(s) defining functions */ +#include "keymodes.pre.h" + +static const Rule rules[] = { + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, True, -1 }, + { "Firefox", NULL, NULL, 1 << 4, False, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.6; /* factor of master area size [0.05..0.95] */ +static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ +static const int layoutaxis[] = { + 1, /* layout axis: 1 = x, 2 = y; negative values mirror the layout, setting the master area to the right / bottom instead of left / top */ + 2, /* master axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle) */ + 2, /* stack axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle) */ +}; + +static const Layout layouts[] = { + /* symbol arrange function */ + { "[M]", monocle }, /* first entry is default */ + { "[]=", tile }, + { "><>", NULL }, /* no layout function means floating behavior */ +}; + +/* key definitions */ +#define MODKEY Mod1Mask +#define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + +/* commands */ +static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; +static const char *haltcmd[] = { "sudo", "halt", NULL }; +static const char *helpcmd[] = { "uxterm", "-e", "man", "dwm", NULL }; +static const char *sleepcmd[] = { "sudo", "pm-suspend", NULL }; +static const char *termcmd[] = { "uxterm", NULL }; +static const char *audio1cmd[] = { "amixer", "--quiet", "sset", "Master", "1+", NULL }; +static const char *audio2cmd[] = { "amixer", "--quiet", "sset", "Master", "1-", NULL }; +static const char *audio3cmd[] = { "amixer", "--quiet", "sset", "Master", "toggle", NULL }; + +#include <X11/XF86keysym.h> +static Key keys[] = { + /* modifier key function argument */ + { 0, XK_Super_L, setkeymode, {.ui = COMMANDMODE} }, + { 0, XF86XK_AudioRaiseVolume, spawn, {.v = audio1cmd} }, + { 0, XF86XK_AudioLowerVolume, spawn, {.v = audio2cmd} }, + { MODKEY|ShiftMask, XK_m, spawn, {.v = audio3cmd} }, + { MODKEY, XK_Down, focusstack, {.i = +1 } }, + { MODKEY, XK_Up, focusstack, {.i = -1 } }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) +}; + +static const int h_master[] = {+1, 2, 2}; +static const int j_master[] = {-2, 1, 1}; +static const int k_master[] = {+2, 1, 1}; +static const int l_master[] = {-1, 2, 2}; + +static Key cmdkeys[] = { + /* modifier keys function argument */ + { 0, XK_Escape, clearcmd, {0} }, + { ControlMask, XK_c, clearcmd, {0} }, + { 0, XK_i, setkeymode, {.ui = INSERTMODE} }, + { 0, XF86XK_Standby, spawn, {.v = sleepcmd} }, +}; +static Command commands[] = { + /* modifier (4 keys) keysyms (4 keys) function argument */ + { {0, 0, 0, 0}, {XK_g, XK_t, 0, 0}, adjacentview, {.i = +1} }, + { {0, ShiftMask, 0, 0}, {XK_g, XK_t, 0, 0}, adjacentview, {.i = -1} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_c, 0, 0}, closewindow, {0} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_h, 0, 0}, focustiled, {.i = -1} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_j, 0, 0}, focustiled, {.i = +2} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_k, 0, 0}, focustiled, {.i = -2} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_l, 0, 0}, focustiled, {.i = +1} }, + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_h, 0, 0}, setmaster, {.v = h_master} }, + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_j, 0, 0}, setmaster, {.v = j_master} }, + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_k, 0, 0}, setmaster, {.v = k_master} }, + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_l, 0, 0}, setmaster, {.v = l_master} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_o, 0, 0}, setlayout, {.v = &layouts[0]} }, + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_o, 0, 0}, onlyclient, {0} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_s, 0, 0}, split, {.ui = 2} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_t, 0, 0}, adjacenttag, {.i = +1} }, + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_t, 0, 0}, adjacenttag, {.i = -1} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_v, 0, 0}, split, {.ui = 1} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_x, 0, 0}, exchangewindow, {.i = +1} }, + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_x, 0, 0}, exchangewindow, {.i = -1} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_w, 0, 0}, focuswindow, {.i = +1} }, + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_w, 0, 0}, focuswindow, {.i = -1} }, + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_0, 0, 0}, setmfact, {.f = +1.50} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_less, 0, 0}, resizemaster, {.f = -10.05} }, + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_less, 0, 0}, resizemaster, {.f = +10.05} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_minus, 0, 0}, resizemaster, {.f = -20.05} }, + { {ControlMask, 0, 0, 0}, {XK_w, XK_plus, 0, 0}, resizemaster, {.f = +20.05} }, + { {ShiftMask, 0, 0, 0}, {XK_period, XK_e, 0, 0}, spawn, {.v = dmenucmd} }, + { {ShiftMask, 0, 0, 0}, {XK_period, XK_o, 0, 0}, spawn, {.v = dmenucmd} }, + { {ShiftMask, ShiftMask, 0, 0}, {XK_period, XK_1, 0, 0}, spawn, {.v = termcmd} }, + { {ControlMask, 0, ShiftMask, 0}, {XK_w, XK_1, XK_t, 0}, tag, {.ui = 1 << 0} }, + { {ControlMask, 0, ShiftMask, 0}, {XK_w, XK_2, XK_t, 0}, tag, {.ui = 1 << 1} }, + { {ControlMask, 0, ShiftMask, 0}, {XK_w, XK_3, XK_t, 0}, tag, {.ui = 1 << 2} }, + { {ControlMask, 0, ShiftMask, 0}, {XK_w, XK_4, XK_t, 0}, tag, {.ui = 1 << 3} }, + { {ControlMask, 0, ShiftMask, 0}, {XK_w, XK_5, XK_t, 0}, tag, {.ui = 1 << 4} }, + { {0, 0, 0, 0}, {XK_1, XK_g, XK_t, 0}, view, {.ui = 1 << 0} }, + { {0, 0, 0, 0}, {XK_2, XK_g, XK_t, 0}, view, {.ui = 1 << 1} }, + { {0, 0, 0, 0}, {XK_3, XK_g, XK_t, 0}, view, {.ui = 1 << 2} }, + { {0, 0, 0, 0}, {XK_4, XK_g, XK_t, 0}, view, {.ui = 1 << 3} }, + { {0, 0, 0, 0}, {XK_5, XK_g, XK_t, 0}, view, {.ui = 1 << 4} }, + { {ShiftMask, 0, 0, 0}, {XK_period, XK_h, XK_Return, 0}, spawn, {.v = helpcmd} }, + { {ShiftMask, 0, 0, 0}, {XK_period, XK_q, XK_Return, 0}, quit, {0} }, + { {ShiftMask, 0, 0, 0}, {XK_period, XK_b, XK_d, XK_Return}, killclient, {0} }, + { {ShiftMask, 0, 0, 0}, {XK_period, XK_b, XK_n, XK_Return}, focusstack, {.i = +1} }, + { {ShiftMask, 0, ShiftMask, 0}, {XK_period, XK_b, XK_n, XK_Return}, focusstack, {.i = -1} }, + { {ShiftMask, 0, ShiftMask, 0}, {XK_period, XK_q, XK_1, XK_Return}, spawn, {.v = haltcmd} }, + { {ShiftMask, 0, 0, 0}, {XK_period, XK_g, XK_o, XK_Return}, togglebar, {0} }, +}; + +/* button definitions */ +/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static Button buttons[] = { + /* click event mask button function argument */ +}; + +/* include(s) depending on the configuration variables */ +#include "keymodes.post.h" diff --git a/dwm.suckless.org/patches/keymodes.md b/dwm.suckless.org/patches/keymodes.md @@ -7,7 +7,7 @@ This patch provides key modes (like in Vim). There are two key modes: 1. `COMMANDMODE`: In this mode any key is grabbed and only the registered command keys have any effect. 2. `INSERTMODE`: This is the normal key mode, in which the original key bindings of dwm and applications are effective and text can be entered. -With key modes you can use any key binding for window management without risking conflicts with existing key bindings in applications. +With key modes you can use any key binding for window management without risking conflicts with existing key bindings in applications or have a Vim-style dwm. There are two different patches: @@ -19,9 +19,9 @@ There are two different patches: (1) Download the favoured patch and apply it according to the [general instructions](.). If you choose vim-keymodes you will have to apply the [flextile patch](./flextile) first. - (2) Transfer the changes made by the patch in 'config.def.h' to your 'config.h', if needed; please see the patch file for details. + (2) Transfer the changes made by the patch in `config.def.h` to your `config.h`, if needed; please see the patch file for details. - (3) Verify the following lines in the aforementioned arrays. The entries in the `cmdkeys` array are defined like those in the original `keys` array of dwm and take precedence over the key bindings defined in the `commands` array. The modifier and keysym definitions in the `commands` array are themselves arrays with four entries, whereas the first entry in the modifier array corresponds to the first entry in the keysym array and so forth. + (3) Verify the following lines in the aforementioned arrays; the key bindings are set in reference to a german keyboard layout. The entries in the `cmdkeys` array are defined like those in the original `keys` array of dwm and take precedence over the key bindings defined in the `commands` array. The modifier and keysym definitions in the `commands` array are themselves arrays with four entries, whereas the first entry in the modifier array corresponds to the first entry in the keysym array and so forth. You can find an example configuration [here][3]. static Key keys[] = { /* modifier key function argument */ @@ -52,3 +52,4 @@ With this patch dwm starts in `COMMANDMODE` and you can use the key bindings as [1]: http://dwm.suckless.org/patches/keymodes-5.8.2.diff [2]: http://dwm.suckless.org/patches/keymodes-5.8.2-vim.diff +[3]: http://dwm.suckless.org/patches/keymodes-5.8.2-vim-example-config.h