sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 9496b912b4518186118cd0bfe1884d47e2dcb1f5
parent 0a39a64c540622763aca077d95ae314d6150ec94
Author: lich <lich@airmail.cc>
Date:   Sat, 14 Apr 2018 11:45:38 +0100

Fixed moveresize patch page

Previous page caused dwm to crash when those edits were added, also
formatting caused the edits to be illegible.

Diffstat:
dwm.suckless.org/patches/moveresize/index.md | 54+++++++++++++++++++++++++++---------------------------
1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/dwm.suckless.org/patches/moveresize/index.md b/dwm.suckless.org/patches/moveresize/index.md @@ -11,37 +11,37 @@ Usage 1. Put the following `moveresize()` function somewhere in your `dwm.c`, **after** the line which includes the config.h file: - static void - moveresize(const Arg *arg) - { - - XEvent ev; - Monitor *m = selmon; - - if(!(m->sel && arg && arg->v && m->sel->isfloating)) - return; - - resize(m->sel, m->sel->x + ((int *)arg->v)[0], - m->sel->y + ((int *)arg->v)[1], - m->sel->w + ((int *)arg->v)[2], - m->sel->h + ((int *)arg->v)[3], - True); - - while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); - } + static void + moveresize(const Arg *arg) + { + + XEvent ev; + Monitor *m = selmon; + + if(!(m->sel && arg && arg->v && m->sel->isfloating)) + return; + + resize(m->sel, m->sel->x + ((int *)arg->v)[0], + m->sel->y + ((int *)arg->v)[1], + m->sel->w + ((int *)arg->v)[2], + m->sel->h + ((int *)arg->v)[3], + True); + + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); + } 2. Insert the bindings into the keys list. Here is an example which uses the arrow keys to move (mod+arrow) or resize (mod+shift+arrow) the selected - client: + client: - { MODKEY, XK_Down, moveresize, {.v = "0x 25y 0w 0h"}}, - { MODKEY, XK_Up, moveresize, {.v = "0x -25y 0w 0h"}}, - { MODKEY, XK_Right, moveresize, {.v = "25x 0y 0w 0h"}}, - { MODKEY, XK_Left, moveresize, {.v = "-25x 0y 0w 0h"}}, - { MODKEY|ShiftMask, XK_Down, moveresize, {.v = "0x 0y 0w 25h"}}, - { MODKEY|ShiftMask, XK_Up, moveresize, {.v = "0x 0y 0w -25h"}}, - { MODKEY|ShiftMask, XK_Right, moveresize, {.v = "0x 0y 25w 0h"}}, - { MODKEY|ShiftMask, XK_Left, moveresize, {.v = "0x 0y -25w 0h"}}, + { MODKEY, XK_Down, moveresize, {.v = (int []){ 0, 25, 0, 0 }}}, + { MODKEY, XK_Up, moveresize, {.v = (int []){ 0, -25, 0, 0 }}}, + { MODKEY, XK_Right, moveresize, {.v = (int []){ 25, 0, 0, 0 }}}, + { MODKEY, XK_Left, moveresize, {.v = (int []){ -25, 0, 0, 0 }}}, + { MODKEY|ShiftMask, XK_Down, moveresize, {.v = (int []){ 0, 0, 0, 25 }}}, + { MODKEY|ShiftMask, XK_Up, moveresize, {.v = (int []){ 0, 0, 0, -25 }}}, + { MODKEY|ShiftMask, XK_Right, moveresize, {.v = (int []){ 0, 0, 25, 0 }}}, + { MODKEY|ShiftMask, XK_Left, moveresize, {.v = (int []){ 0, 0, -25, 0 }}}, If you want to automatically toggle the client floating when move/resize, replace the `if()` statement above with this code: