dwm-keymodes-vim-5.8.2.diff (21593B)
1 diff -up ../dwm-5.8.2-1/config.def.h ./config.def.h 2 --- ../dwm-5.8.2-1/config.def.h 2010-06-11 01:10:05.465026000 +0200 3 +++ ./config.def.h 2010-06-11 01:13:49.211525000 +0200 4 @@ -19,6 +19,9 @@ static const char *tags[] = { "1", "2", 5 /* include(s) depending on the tags array */ 6 #include "flextile.h" 7 8 +/* include(s) defining functions */ 9 +#include "keymodes.pre.h" 10 + 11 static const Rule rules[] = { 12 /* class instance title tags mask isfloating monitor */ 13 { "Gimp", NULL, NULL, 0, True, -1 }, 14 @@ -36,9 +39,9 @@ static const int layoutaxis[] = { 15 16 static const Layout layouts[] = { 17 /* symbol arrange function */ 18 - { "[]=", tile }, /* first entry is default */ 19 + { "[M]", monocle }, /* first entry is default */ 20 + { "[]=", tile }, 21 { "><>", NULL }, /* no layout function means floating behavior */ 22 - { "[M]", monocle }, 23 }; 24 25 /* key definitions */ 26 @@ -55,9 +58,11 @@ static const Layout layouts[] = { 27 /* commands */ 28 static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; 29 static const char *termcmd[] = { "uxterm", NULL }; 30 +static const char *helpcmd[] = { "uxterm", "-e", "man", "dwm", NULL }; 31 32 static Key keys[] = { 33 /* modifier key function argument */ 34 + { MODKEY, XK_Escape, setkeymode, {.ui = COMMANDMODE} }, 35 { MODKEY, XK_p, spawn, {.v = dmenucmd } }, 36 { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, 37 { MODKEY, XK_b, togglebar, {0} }, 38 @@ -68,9 +73,9 @@ static Key keys[] = { 39 { MODKEY, XK_Return, zoom, {0} }, 40 { MODKEY, XK_Tab, view, {0} }, 41 { MODKEY|ShiftMask, XK_c, killclient, {0} }, 42 - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 43 - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 44 - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 45 + { MODKEY, XK_m, setlayout, {.v = &layouts[0]} }, 46 + { MODKEY, XK_t, setlayout, {.v = &layouts[1]} }, 47 + { MODKEY, XK_f, setlayout, {.v = &layouts[2]} }, 48 { MODKEY, XK_space, setlayout, {0} }, 49 { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 50 { MODKEY, XK_0, view, {.ui = ~0 } }, 51 @@ -97,6 +102,54 @@ static Key keys[] = { 52 { MODKEY|ControlMask, XK_l, shiftmastersplit, {.i = +1} }, /* increase the number of tiled clients in the master area */ 53 }; 54 55 +static const int h_master[] = {+1, 2, 2}; 56 +static const int j_master[] = {-2, 1, 1}; 57 +static const int k_master[] = {+2, 1, 1}; 58 +static const int l_master[] = {-1, 2, 2}; 59 + 60 +static Key cmdkeys[] = { 61 + /* modifier keys function argument */ 62 + { 0, XK_Escape, clearcmd, {0} }, 63 + { ControlMask, XK_c, clearcmd, {0} }, 64 + { 0, XK_i, setkeymode, {.ui = INSERTMODE} }, 65 +}; 66 +static Command commands[] = { 67 + /* modifier (4 keys) keysyms (4 keys) function argument */ 68 + { {0, 0, 0, 0}, {XK_g, XK_t, 0, 0}, adjacentview, {.i = +1} }, 69 + { {0, ShiftMask, 0, 0}, {XK_g, XK_t, 0, 0}, adjacentview, {.i = -1} }, 70 + { {ControlMask, 0, 0, 0}, {XK_w, XK_c, 0, 0}, closewindow, {0} }, 71 + { {ControlMask, 0, 0, 0}, {XK_w, XK_h, 0, 0}, focustiled, {.i = -1} }, 72 + { {ControlMask, 0, 0, 0}, {XK_w, XK_j, 0, 0}, focustiled, {.i = +2} }, 73 + { {ControlMask, 0, 0, 0}, {XK_w, XK_k, 0, 0}, focustiled, {.i = -2} }, 74 + { {ControlMask, 0, 0, 0}, {XK_w, XK_l, 0, 0}, focustiled, {.i = +1} }, 75 + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_h, 0, 0}, setmaster, {.v = h_master} }, 76 + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_j, 0, 0}, setmaster, {.v = j_master} }, 77 + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_k, 0, 0}, setmaster, {.v = k_master} }, 78 + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_l, 0, 0}, setmaster, {.v = l_master} }, 79 + { {ControlMask, 0, 0, 0}, {XK_w, XK_o, 0, 0}, setlayout, {.v = &layouts[0]} }, 80 + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_o, 0, 0}, onlyclient, {0} }, 81 + { {ControlMask, 0, 0, 0}, {XK_w, XK_s, 0, 0}, split, {.ui = 2} }, 82 + { {ControlMask, 0, 0, 0}, {XK_w, XK_t, 0, 0}, adjacenttag, {.i = +1} }, 83 + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_t, 0, 0}, adjacenttag, {.i = -1} }, 84 + { {ControlMask, 0, 0, 0}, {XK_w, XK_v, 0, 0}, split, {.ui = 1} }, 85 + { {ControlMask, 0, 0, 0}, {XK_w, XK_x, 0, 0}, exchangewindow, {.i = +1} }, 86 + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_x, 0, 0}, exchangewindow, {.i = -1} }, 87 + { {ControlMask, 0, 0, 0}, {XK_w, XK_w, 0, 0}, focuswindow, {.i = +1} }, 88 + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_w, 0, 0}, focuswindow, {.i = -1} }, 89 + { {ControlMask, 0, 0, 0}, {XK_w, XK_less, 0, 0}, resizemaster, {.f = -10.05} }, 90 + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_less, 0, 0}, resizemaster, {.f = +10.05} }, 91 + { {ControlMask, 0, 0, 0}, {XK_w, XK_minus, 0, 0}, resizemaster, {.f = -20.05} }, 92 + { {ControlMask, 0, 0, 0}, {XK_w, XK_plus, 0, 0}, resizemaster, {.f = +20.05} }, 93 + { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_0, 0, 0}, setmfact, {.f = +1.50} }, 94 + { {ShiftMask, 0, 0, 0}, {XK_period, XK_e, 0, 0}, spawn, {.v = dmenucmd} }, 95 + { {ShiftMask, 0, 0, 0}, {XK_period, XK_o, 0, 0}, spawn, {.v = dmenucmd} }, 96 + { {ShiftMask, 0, 0, 0}, {XK_period, XK_h, XK_Return, 0}, spawn, {.v = helpcmd} }, 97 + { {ShiftMask, 0, 0, 0}, {XK_period, XK_q, XK_Return, 0}, quit, {0} }, 98 + { {ShiftMask, 0, 0, 0}, {XK_period, XK_b, XK_d, XK_Return}, killclient, {0} }, 99 + { {ShiftMask, 0, 0, 0}, {XK_period, XK_b, XK_n, XK_Return}, focusstack, {.i = +1} }, 100 + { {ShiftMask, 0, ShiftMask, 0}, {XK_period, XK_b, XK_n, XK_Return}, focusstack, {.i = -1} }, 101 +}; 102 + 103 /* button definitions */ 104 /* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ 105 static Button buttons[] = { 106 @@ -114,3 +167,5 @@ static Button buttons[] = { 107 { ClkTagBar, MODKEY, Button3, toggletag, {0} }, 108 }; 109 110 +/* include(s) depending on the configuration variables */ 111 +#include "keymodes.post.h" 112 diff -up ../dwm-5.8.2-1/dwm.c ./dwm.c 113 --- ../dwm-5.8.2-1/dwm.c 2010-06-11 01:10:05.473958000 +0200 114 +++ ./dwm.c 2010-06-11 01:13:49.226865000 +0200 115 @@ -954,7 +954,7 @@ grabbuttons(Client *c, Bool focused) { 116 } 117 118 void 119 -grabkeys(void) { 120 +grabdefkeys(void) { 121 updatenumlockmask(); 122 { 123 unsigned int i, j; 124 @@ -1036,7 +1036,7 @@ isuniquegeom(XineramaScreenInfo *unique, 125 #endif /* XINERAMA */ 126 127 void 128 -keypress(XEvent *e) { 129 +defkeypress(XEvent *e) { 130 unsigned int i; 131 KeySym keysym; 132 XKeyEvent *ev; 133 diff -up ../dwm-5.8.2-1/keymodes.post.h ./keymodes.post.h 134 --- ../dwm-5.8.2-1/keymodes.post.h 2010-06-11 01:12:53.000000000 +0200 135 +++ ./keymodes.post.h 2010-06-11 01:13:49.287434000 +0200 136 @@ -0,0 +1,409 @@ 137 +/* See LICENSE file for copyright and license details. */ 138 +/* © 2010 joten <joten@freenet.de> */ 139 + 140 +/* function implementations */ 141 +void 142 +adjacenttag(const Arg *arg) { 143 + int nexttag = selmon->curtag + arg->i; 144 + Arg a; 145 + 146 + if(nexttag > LENGTH(tags)) 147 + nexttag = 1; 148 + else if(nexttag < 1) 149 + nexttag = LENGTH(tags); 150 + a.ui = 1 << (nexttag - 1); 151 + tag(&a); 152 +} 153 + 154 +void 155 +adjacentview(const Arg *arg) { 156 + int nexttag = selmon->curtag + arg->i; 157 + Arg a; 158 + 159 + if(nexttag > LENGTH(tags)) 160 + nexttag = 1; 161 + else if(nexttag < 1) 162 + nexttag = LENGTH(tags); 163 + a.ui = 1 << (nexttag - 1); 164 + view(&a); 165 +} 166 + 167 +void 168 +clearcmd(const Arg *arg) { 169 + unsigned int i; 170 + 171 + for(i = 0; i < LENGTH(cmdkeysym); i++) { 172 + cmdkeysym[i] = 0; 173 + cmdmod[i] = 0; 174 + } 175 +} 176 + 177 +void 178 +closewindow(const Arg *arg) { 179 + unsigned int j, n; 180 + Client *i; 181 + 182 + if(!selmon->sel || selmon->sel->isfloating || selmon->lt[selmon->sellt]->arrange != tile) 183 + return; 184 + for(n = 0, i = nexttiled(selmon->clients); i; i = nexttiled(i->next), n++) 185 + if(i == selmon->sel) 186 + j = n + 1; 187 + if(j == 0 || n < 2) 188 + return; 189 + if(j <= selmon->msplit) { 190 + if(selmon->ltaxis[1] == 3 || selmon->msplit == 1) { 191 + selmon->msplits[selmon->curtag] = selmon->msplit = n; 192 + selmon->ltaxes[selmon->curtag][1] = selmon->ltaxis[1] = selmon->ltaxis[2]; 193 + selmon->ltaxes[selmon->curtag][2] = selmon->ltaxis[2] = 3; 194 + } else if(j == selmon->msplit && (selmon->ltaxis[2] == 3 || selmon->msplit == n - 1)) { 195 + selmon->msplits[selmon->curtag] = selmon->msplit -= 1; 196 + selmon->ltaxes[selmon->curtag][2] = selmon->ltaxis[2] = 3; 197 + } else 198 + selmon->ltaxes[selmon->curtag][1] = selmon->ltaxis[1] = 3; 199 + } else { 200 + if(selmon->ltaxis[2] == 3 || selmon->msplit == n - 1) 201 + selmon->msplits[selmon->curtag] = selmon->msplit = n; 202 + else if(j == selmon->msplit + 1 && (selmon->ltaxis[1] == 3 || selmon->msplit == 1)) { 203 + selmon->msplits[selmon->curtag] = selmon->msplit += 1; 204 + selmon->ltaxes[selmon->curtag][1] = selmon->ltaxis[1] = 3; 205 + } else 206 + selmon->ltaxes[selmon->curtag][2] = selmon->ltaxis[2] = 3; 207 + } 208 + arrange(selmon); 209 +} 210 + 211 +void 212 +exchangewindow(const Arg *arg) { 213 + int j = 0, n; 214 + Client *c, *i, *sel = selmon->sel; 215 + 216 + if(!sel || sel->isfloating || selmon->lt[selmon->sellt]->arrange != tile) 217 + return; 218 + for(n = 0, i = nexttiled(selmon->clients); i; i = nexttiled(i->next), n++) 219 + if(i == selmon->sel) 220 + j = n + 1; 221 + if(j == 0 || n < 2 222 + || (j <= selmon->msplit && selmon->ltaxis[1] == 3 && selmon->msplit > 1 && !(j == 1 && arg->i < 0) && !(j == selmon->msplit && arg->i > 0)) 223 + || (j > selmon->msplit && selmon->ltaxis[2] == 3 && n - selmon->msplit > 1 && !(j == selmon->msplit + 1 && arg->i < 0) && !(j == n && arg->i > 0))) 224 + return; 225 + if(arg->i < 0) { 226 + if((c = prevtiled(sel))) { 227 + /* attach before c */ 228 + detach(sel); 229 + sel->next = c; 230 + if(selmon->clients == c) 231 + selmon->clients = sel; 232 + else { 233 + for(c = selmon->clients; c->next != sel->next; c = c->next); 234 + c->next = sel; 235 + } 236 + } else { 237 + /* move to the end */ 238 + for(c = sel; c->next; c = c->next); 239 + detach(sel); 240 + sel->next = NULL; 241 + c->next = sel; 242 + } 243 + } else { 244 + if((c = nexttiled(sel->next))) { 245 + /* attach after c */ 246 + detach(sel); 247 + sel->next = c->next; 248 + c->next = sel; 249 + } else { 250 + /* move to the front */ 251 + detach(sel); 252 + attach(sel); 253 + } 254 + } 255 + focus(sel); 256 + arrange(selmon); 257 +} 258 + 259 +void 260 +focustiled(const Arg *arg) { 261 + float f; 262 + unsigned int j = 0, k, n; 263 + Client *c = NULL, *i; 264 + 265 + if(!selmon->sel || selmon->sel->isfloating || (selmon->lt[selmon->sellt]->arrange != monocle && selmon->lt[selmon->sellt]->arrange != tile)) 266 + return; 267 + for(n = 0, i = nexttiled(selmon->clients); i; i = nexttiled(i->next), n++) 268 + if(i == selmon->sel) 269 + j = n + 1; 270 + if(n < 2) 271 + return; 272 + if(arg->i < 0 273 + && ((j > 1 && j <= selmon->msplit && selmon->ltaxis[1] == -(arg->i)) || (j > (selmon->msplit + 1) && j <= n && selmon->ltaxis[2] == -(arg->i)))) { 274 + c = prevtiled(selmon->sel); 275 + } else if(arg->i > 0 276 + && ((j > 0 && j < selmon->msplit && selmon->ltaxis[1] == arg->i) || (j > selmon->msplit && j < n && selmon->ltaxis[2] == arg->i))) { 277 + c = nexttiled(selmon->sel->next); 278 + } else if(arg->i < 0 279 + && n > selmon->msplit 280 + && j > selmon->msplit && j <= n 281 + && (selmon->ltaxis[2] - arg->i) == 3) 282 + f = (float)(j - selmon->msplit) / (n - selmon->msplit) * selmon->msplit; 283 + else if(arg->i > 0 284 + && n > selmon->msplit 285 + && j > 0 && j <= selmon->msplit 286 + && (selmon->ltaxis[1] + arg->i) == 3) 287 + f = selmon->msplit + (float)j / selmon->msplit * (n - selmon->msplit); 288 + if(f > 0) { 289 + k = (unsigned int)f; 290 + if(f - k > 0) 291 + k++; 292 + for(j = 1, i = nexttiled(selmon->clients); i; i = nexttiled(i->next), j++) 293 + if(j == k) 294 + c = i; 295 + } 296 + if(c) { 297 + focus(c); 298 + restack(selmon); 299 + } 300 +} 301 + 302 +void 303 +focuswindow(const Arg *arg) { 304 + unsigned int j = 0, k = 0, n; 305 + Client *c = NULL, *i; 306 + 307 + if(!selmon->sel || selmon->sel->isfloating || selmon->lt[selmon->sellt]->arrange != tile) 308 + return; 309 + for(n = 0, i = nexttiled(selmon->clients); i; i = nexttiled(i->next), n++) 310 + if(i == selmon->sel) 311 + j = n + 1; 312 + if(j == 0 || n < 2 || (selmon->msplit == n && selmon->ltaxis[1] == 3)) 313 + return; 314 + if(arg->i < 0) { 315 + if((j > 1 && j <= selmon->msplit && selmon->ltaxis[1] == 3) || j == 1) { 316 + k = n; 317 + } else if(j > selmon->msplit + 1 && j <= n && selmon->ltaxis[2] == 3) { 318 + k = selmon->msplit; 319 + } else 320 + c = prevtiled(selmon->sel); 321 + } else { 322 + if(j < selmon->msplit && selmon->ltaxis[1] == 3) { 323 + k = selmon->msplit + 1; 324 + } else if((j > selmon->msplit && j < n && selmon->ltaxis[2] == 3) || j == n) { 325 + k = 1; 326 + } else 327 + c = nexttiled(selmon->sel->next); 328 + } 329 + if(!c && k) 330 + for(j = 1, i = nexttiled(selmon->clients); i; i = nexttiled(i->next), j++) 331 + if(j == k) 332 + c = i; 333 + if(c) { 334 + focus(c); 335 + restack(selmon); 336 + } 337 +} 338 + 339 +void 340 +grabkeys(void) { 341 + if(keymode == INSERTMODE) { 342 + grabdefkeys(); 343 + } else if(keymode == COMMANDMODE) { 344 + XUngrabKey(dpy, AnyKey, AnyModifier, root); 345 + XGrabKey(dpy, AnyKey, AnyModifier, root, 346 + True, GrabModeAsync, GrabModeAsync); 347 + } 348 +} 349 + 350 +void 351 +keypress(XEvent *e) { 352 + unsigned int i, j; 353 + Arg a = {0}; 354 + Bool ismatch = False, maybematch = False; 355 + KeySym keysym; 356 + XKeyEvent *ev; 357 + 358 + if(keymode == INSERTMODE) 359 + defkeypress(e); 360 + else if(keymode == COMMANDMODE) { 361 + ev = &e->xkey; 362 + keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); 363 + if(keysym < XK_Shift_L || keysym > XK_Hyper_R) { 364 + for(i = 0; i < LENGTH(cmdkeys); i++) 365 + if(keysym == cmdkeys[i].keysym 366 + && CLEANMASK(cmdkeys[i].mod) == CLEANMASK(ev->state) 367 + && cmdkeys[i].func) { 368 + cmdkeys[i].func(&(cmdkeys[i].arg)); 369 + ismatch = True; 370 + break; 371 + } 372 + if(!ismatch) { 373 + for(j = 0; j < LENGTH(cmdkeysym); j++) 374 + if(cmdkeysym[j] == 0) { 375 + cmdkeysym[j] = keysym; 376 + cmdmod[j] = ev->state; 377 + break; 378 + } 379 + for(i = 0; i < LENGTH(commands); i++) { 380 + for(j = 0; j < LENGTH(cmdkeysym); j++) { 381 + if(cmdkeysym[j] == commands[i].keysym[j] 382 + && CLEANMASK(cmdmod[j]) == CLEANMASK(commands[i].mod[j])) 383 + ismatch = True; 384 + else if(cmdkeysym[j] == 0 385 + && cmdmod[j] == 0) { 386 + ismatch = False; 387 + maybematch = True; 388 + break; 389 + } else { 390 + ismatch = False; 391 + break; 392 + } 393 + } 394 + if(ismatch) { 395 + if(commands[i].func) 396 + commands[i].func(&(commands[i].arg)); 397 + clearcmd(&a); 398 + break; 399 + } 400 + 401 + } 402 + if(!maybematch) 403 + clearcmd(&a); 404 + } 405 + } 406 + } 407 +} 408 + 409 +void 410 +onlyclient(const Arg *arg) { 411 + Client *c; 412 + XEvent ev; 413 + 414 + if(!selmon->sel) 415 + return; 416 + for(c = selmon->clients; c; c = c->next) 417 + if(c != selmon->sel && ISVISIBLE(c)) { 418 + if(isprotodel(c)) { 419 + ev.type = ClientMessage; 420 + ev.xclient.window = c->win; 421 + ev.xclient.message_type = wmatom[WMProtocols]; 422 + ev.xclient.format = 32; 423 + ev.xclient.data.l[0] = wmatom[WMDelete]; 424 + ev.xclient.data.l[1] = CurrentTime; 425 + XSendEvent(dpy, c->win, False, NoEventMask, &ev); 426 + } 427 + else { 428 + XGrabServer(dpy); 429 + XSetErrorHandler(xerrordummy); 430 + XSetCloseDownMode(dpy, DestroyAll); 431 + XKillClient(dpy, c->win); 432 + XSync(dpy, False); 433 + XSetErrorHandler(xerror); 434 + XUngrabServer(dpy); 435 + } 436 + } 437 +} 438 + 439 +Client * 440 +prevtiled(Client *c) { 441 + Client *i, *p; 442 + 443 + for(i = selmon->clients, p = NULL; i && i != c; i = i->next) 444 + if(!i->isfloating && ISVISIBLE(i)) 445 + p = i; 446 + return p; 447 +} 448 + 449 +void 450 +resizemaster(const Arg *arg) { 451 + float f; 452 + Arg a; 453 + 454 + if(!arg || selmon->lt[selmon->sellt]->arrange != tile) 455 + return; 456 + f = (arg->f < 0 ? -arg->f : arg->f) - selmon->ltaxis[0] * 10; 457 + if(f < 0 || f > 1.9) 458 + return; 459 + a.f = arg->f / abs(arg->f) * f; 460 + setmfact(&a); 461 +} 462 + 463 +void 464 +setkeymode(const Arg *arg) { 465 + Arg a = {0}; 466 + 467 + if(!arg) 468 + return; 469 + keymode = arg->ui; 470 + clearcmd(&a); 471 + grabkeys(); 472 +} 473 + 474 +void 475 +setmaster(const Arg *arg) { 476 + unsigned int i; 477 + Arg a; 478 + 479 + if(!arg || (selmon->lt[selmon->sellt]->arrange != monocle && selmon->lt[selmon->sellt]->arrange != tile)) 480 + return; 481 + for(i = 0; i < 3; i++) 482 + selmon->ltaxes[selmon->curtag][i] = selmon->ltaxis[i] = ((int *)arg->i)[i]; 483 + selmon->msplits[selmon->curtag] = selmon->msplit = 1; 484 + if(selmon->sel && !selmon->sel->isfloating && selmon->sel != nexttiled(selmon->clients)) { 485 + detach(selmon->sel); 486 + attach(selmon->sel); 487 + focus(selmon->sel); 488 + } 489 + if(selmon->lt[selmon->sellt]->arrange == monocle) { 490 + for(i = 0; i < LENGTH(layouts) && (&layouts[i])->arrange != tile; i++); 491 + a.v = &layouts[i]; 492 + setlayout(&a); 493 + if(!selmon->sel) 494 + arrange(selmon); 495 + } else 496 + arrange(selmon); 497 +} 498 + 499 +void 500 +split(const Arg *arg) { 501 + unsigned int j = 0, k, n; 502 + Arg a; 503 + Client *i; 504 + 505 + if(!arg || !selmon->sel || selmon->sel->isfloating || (selmon->lt[selmon->sellt]->arrange != monocle && selmon->lt[selmon->sellt]->arrange != tile)) 506 + return; 507 + for(n = 0, i = nexttiled(selmon->clients); i; i = nexttiled(i->next), n++) 508 + if(i == selmon->sel) 509 + j = n + 1; 510 + if(j == 0 || n < 2) 511 + return; 512 + if(selmon->lt[selmon->sellt]->arrange == monocle) { 513 + selmon->ltaxes[selmon->curtag][0] = selmon->ltaxis[0] = arg->i; 514 + selmon->ltaxes[selmon->curtag][1] = selmon->ltaxis[1] = 3; 515 + selmon->ltaxes[selmon->curtag][2] = selmon->ltaxis[2] = 3; 516 + for(k = 0; k < LENGTH(layouts) && (&layouts[k])->arrange != tile; k++); 517 + a.v = &layouts[k]; 518 + setlayout(&a); 519 + } else if(j <= selmon->msplit) { 520 + if(selmon->ltaxis[1] == 3 || selmon->msplit == 1) { 521 + selmon->ltaxes[selmon->curtag][1] = selmon->ltaxis[1] = arg->i; 522 + if(selmon->ltaxis[2] == 3 || selmon->msplit == 1) 523 + selmon->msplits[selmon->curtag] = selmon->msplit = 2; 524 + arrange(selmon); 525 + } else if(selmon->ltaxis[1] == arg->i && selmon->msplit < n) { 526 + selmon->msplits[selmon->curtag] = selmon->msplit += 1; 527 + arrange(selmon); 528 + } else if(selmon->ltaxis[1] + arg->i == 3 && selmon->msplit == n) { 529 + selmon->ltaxes[selmon->curtag][0] = selmon->ltaxis[0] = arg->i; 530 + selmon->ltaxes[selmon->curtag][2] = selmon->ltaxis[2] = 3; 531 + selmon->msplits[selmon->curtag] = selmon->msplit = n - 1; 532 + arrange(selmon); 533 + } 534 + } else if(n > 2) { 535 + if(selmon->ltaxis[2] == 3 || selmon->msplit == n - 1) { 536 + selmon->ltaxes[selmon->curtag][2] = selmon->ltaxis[2] = arg->i; 537 + if(selmon->ltaxis[1] == 3 || selmon->msplit == n - 1) 538 + selmon->msplits[selmon->curtag] = selmon->msplit = n - 2; 539 + arrange(selmon); 540 + } else if(selmon->ltaxis[2] == arg->i && selmon->msplit > 1) { 541 + selmon->msplits[selmon->curtag] = selmon->msplit -= 1; 542 + arrange(selmon); 543 + } 544 + } 545 +} 546 diff -up ../dwm-5.8.2-1/keymodes.pre.h ./keymodes.pre.h 547 --- ../dwm-5.8.2-1/keymodes.pre.h 2010-06-11 01:12:49.000000000 +0200 548 +++ ./keymodes.pre.h 2010-06-11 01:13:50.660576000 +0200 549 @@ -0,0 +1,34 @@ 550 +/* See LICENSE file for copyright and license details. */ 551 +/* © 2010 joten <joten@freenet.de> */ 552 + 553 +#define COMMANDMODE 1 554 +#define INSERTMODE 2 555 + 556 +typedef struct { 557 + unsigned int mod[4]; 558 + KeySym keysym[4]; 559 + void (*func)(const Arg *); 560 + const Arg arg; 561 +} Command; 562 + 563 +/* function declarations */ 564 +static void adjacenttag(const Arg *arg); 565 +static void adjacentview(const Arg *arg); 566 +static void clearcmd(const Arg *arg); 567 +static void closewindow(const Arg *arg); 568 +static void defkeypress(XEvent *e); 569 +static void exchangewindow(const Arg *arg); 570 +static void focustiled(const Arg *arg); 571 +static void focuswindow(const Arg *arg); 572 +static void grabdefkeys(void); 573 +static void onlyclient(const Arg *arg); 574 +static Client *prevtiled(Client *c); 575 +static void resizemaster(const Arg *arg); 576 +static void setkeymode(const Arg *arg); 577 +static void setmaster(const Arg *arg); 578 +static void split(const Arg *arg); 579 + 580 +/* variables */ 581 +static unsigned int cmdmod[4]; 582 +static unsigned int keymode = COMMANDMODE; 583 +static KeySym cmdkeysym[4];