sites

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

commit 3e98231745aa6ed42e29c160c0f60e9504da102c
parent fad018a5967adc2df36537ee9e7411b0bf715b7d
Author: Jan Christoph Ebersbach <jceb@e-jc.de>
Date:   Tue, 14 Feb 2012 21:19:32 +0100

update moveresize and maximize_vert_horz patches to dwm 6.0
Diffstat:
Adwm.suckless.org/patches/dwm-6.0-maximize_vert_horz.diff | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/dwm-6.0-moveresize.diff | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddwm.suckless.org/patches/historical/moveresize.md | 64----------------------------------------------------------------
Mdwm.suckless.org/patches/moveresize.md | 90+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
4 files changed, 230 insertions(+), 70 deletions(-)

diff --git a/dwm.suckless.org/patches/dwm-6.0-maximize_vert_horz.diff b/dwm.suckless.org/patches/dwm-6.0-maximize_vert_horz.diff @@ -0,0 +1,74 @@ +URL: http://dwm.suckless.org/patches/historical/moveresize +These patches provide helper functions for moving and resizing floating windows +using keybindings. + +diff -r 6f54bd1ef439 dwm.c +--- a/dwm.c Wed Jan 04 13:30:12 2012 +0100 ++++ b/dwm.c Sun Feb 12 09:32:28 2012 +0100 +@@ -90,7 +90,7 @@ + int basew, baseh, incw, inch, maxw, maxh, minw, minh; + int bw, oldbw; + unsigned int tags; +- Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; ++ Bool ismax, wasfloating, isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + Client *next; + Client *snext; + Monitor *mon; +@@ -1151,6 +1151,8 @@ + updatewmhints(c); + XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); + grabbuttons(c, False); ++ c->wasfloating = False; ++ c->ismax = False; + if(!c->isfloating) + c->isfloating = c->oldstate = trans != None || c->isfixed; + if(c->isfloating) +diff -r 6f54bd1ef439 maximize.c +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/maximize.c Sun Feb 12 09:32:28 2012 +0100 +@@ -0,0 +1,45 @@ ++void ++maximize(int x, int y, int w, int h) { ++ XEvent ev; ++ ++ if(!selmon->sel || selmon->sel->isfixed) ++ return; ++ XRaiseWindow(dpy, selmon->sel->win); ++ if(!selmon->sel->ismax) { ++ if(!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating) ++ selmon->sel->wasfloating = True; ++ else { ++ togglefloating(NULL); ++ selmon->sel->wasfloating = False; ++ } ++ selmon->sel->oldx = selmon->sel->x; ++ selmon->sel->oldy = selmon->sel->y; ++ selmon->sel->oldw = selmon->sel->w; ++ selmon->sel->oldh = selmon->sel->h; ++ resize(selmon->sel, x, y, w, h, True); ++ selmon->sel->ismax = True; ++ } ++ else { ++ resize(selmon->sel, selmon->sel->oldx, selmon->sel->oldy, selmon->sel->oldw, selmon->sel->oldh, True); ++ if(!selmon->sel->wasfloating) ++ togglefloating(NULL); ++ selmon->sel->ismax = False; ++ } ++ drawbar(selmon); ++ while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); ++} ++ ++void ++togglemaximize(const Arg *arg) { ++ maximize(selmon->wx, selmon->wy, selmon->ww - 2 * borderpx, selmon->wh - 2 * borderpx); ++} ++ ++void ++toggleverticalmax(const Arg *arg) { ++ maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh - 2 * borderpx); ++} ++ ++void ++togglehorizontalmax(const Arg *arg) { ++ maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * borderpx, selmon->sel->h); ++} diff --git a/dwm.suckless.org/patches/dwm-6.0-moveresize.diff b/dwm.suckless.org/patches/dwm-6.0-moveresize.diff @@ -0,0 +1,72 @@ +URL: http://dwm.suckless.org/patches/historical/moveresize +These patches provide helper functions for moving and resizing floating windows +using keybindings. + +diff -r 6f54bd1ef439 moveresize.c +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/moveresize.c Sun Feb 12 09:32:20 2012 +0100 +@@ -0,0 +1,64 @@ ++void ++moveresize(const Arg *arg) { ++ /* only floating windows can be moved */ ++ Client *c; ++ c = selmon->sel; ++ int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh; ++ char xAbs, yAbs, wAbs, hAbs; ++ int msx, msy, dx, dy, nmx, nmy; ++ unsigned int dui; ++ Window dummy; ++ ++ if (!c || !arg) ++ return; ++ if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) ++ return; ++ if(sscanf((char *)arg->v, "%d%c %d%c %d%c %d%c", &x, &xAbs, &y, &yAbs, &w, &wAbs, &h, &hAbs) != 8) ++ return; ++ /* compute new window position; prevent window from be positioned outside the current monitor */ ++ nw = c->w + w; ++ if(wAbs == 'W') ++ nw = w < selmon->mw - 2 * c->bw ? w : selmon->mw - 2 * c->bw; ++ ++ nh = c->h + h; ++ if(hAbs == 'H') ++ nh = h < selmon->mh - 2 * c->bw ? h : selmon->mh - 2 * c->bw; ++ ++ nx = c->x + x; ++ if(xAbs == 'X') { ++ if(x < selmon->mx) ++ nx = selmon->mx; ++ else if(x > selmon->mx + selmon->mw) ++ nx = selmon->mx + selmon->mw - nw - 2 * c->bw; ++ else ++ nx = x; ++ } ++ ++ ny = c->y + y; ++ if(yAbs == 'Y') { ++ if(y < selmon->my) ++ ny = selmon->my; ++ else if(y > selmon->my + selmon->mh) ++ ny = selmon->my + selmon->mh - nh - 2 * c->bw; ++ else ++ ny = y; ++ } ++ ++ ox = c->x; ++ oy = c->y; ++ ow = c->w; ++ oh = c->h; ++ ++ XRaiseWindow(dpy, c->win); ++ Bool xqp = XQueryPointer(dpy, root, &dummy, &dummy, &msx, &msy, &dx, &dy, &dui); ++ resize(c, nx, ny, nw, nh, True); ++ ++ /* move cursor along with the window to avoid problems caused by the sloppy focus */ ++ if (xqp && ox <= msx && (ox + ow) >= msx && oy <= msy && (oy + oh) >= msy) ++ { ++ nmx = c->x - ox + c->w - ow; ++ nmy = c->y - oy + c->h - oh; ++ XWarpPointer(dpy, None, None, 0, 0, 0, 0, nmx, nmy); ++ } ++} ++ diff --git a/dwm.suckless.org/patches/historical/moveresize.md b/dwm.suckless.org/patches/historical/moveresize.md @@ -1,64 +0,0 @@ -MOVE RESIZE AND MAXIMIZE VERTICAL/HORIZONTAL PATCH -================================================== - -Description ------------ -These patches provide helper functions for moving and resizing floating windows using keybindings. - -Configuration -------------- -This is a sample 'hjkl'-style configuration: - - { MODKEY, XK_h, moveresize, "-25x 0y 0w 0h" }, \ - { MODKEY, XK_l, moveresize, "25x 0y 0w 0h" }, \ - { MODKEY, XK_j, moveresize, "0x 25y 0w 0h" }, \ - { MODKEY, XK_k, moveresize, "0x -25y 0w 0h" }, \ - { MODKEY|ControlMask, XK_h, moveresize, "0X 0y 0w 0h" }, \ - { MODKEY|ControlMask, XK_l, moveresize, "9000X 0y 0w 0h" }, \ - { MODKEY|ControlMask, XK_j, moveresize, "0x 9000Y 0w 0h" }, \ - { MODKEY|ControlMask, XK_k, moveresize, "0x 15Y 0w 0h" }, \ - { MODKEY|ShiftMask, XK_h, moveresize, "0x 0y -25w 0h" }, \ - { MODKEY|ShiftMask, XK_l, moveresize, "0x 0y 25w 0h" }, \ - { MODKEY|ShiftMask, XK_j, moveresize, "0x 0y 0w 25h" }, \ - { MODKEY|ShiftMask, XK_k, moveresize, "0x 0y 0w -25h" }, \ - { MODKEY|ControlMask|ShiftMask, XK_h, togglehorizontalmax, NULL }, \ - { MODKEY|ControlMask|ShiftMask, XK_l, togglehorizontalmax, NULL }, \ - { MODKEY|ControlMask|ShiftMask, XK_j, toggleverticalmax, NULL }, \ - { MODKEY|ControlMask|ShiftMask, XK_k, toggleverticalmax, NULL }, \ - -Download --------- - -5.0 - - * [dwm-5.0-moveresize.diff][7] - * [dwm-5.0-maximize_vert_horz.diff][8] - -4.6 - - * [dwm-4.6-moveresize.diff][5] - * [dwm-4.6-maximize_vert_horz.diff][6] - -4.5 - - * [dwm-4.5-moveresize.diff][3] - * [dwm-4.5-maximize_vert_horz.diff][4] - -4.4 - - * [dwm-4.4-moveresize.diff][1] - * [dwm-4.4-maximize_vert_horz.diff][2] - -Author ------- - * Jan Christoph Ebersbach - <jceb@e-jc.de> - -[1]: http://www.e-jc.de/dwm/dwm-4.4-moveresize.diff -[2]: http://www.e-jc.de/dwm/dwm-4.4-maximize_vert_horz.diff -[3]: http://www.e-jc.de/dwm/4.5/dwm-4.5-tip_ac233c362502-moveresize.diff -[4]: http://www.e-jc.de/dwm/4.5/dwm-4.5-tip_ac233c362502-maximize_vert_horz.diff -[5]: http://www.e-jc.de/dwm/4.6/current/dwm-4.6-moveresize.diff -[6]: http://www.e-jc.de/dwm/4.6/current/dwm-4.6-maximize_vert_horz.diff -[7]: http://www.e-jc.de/dwm/5.0/current/dwm-5.0-moveresize.diff -[8]: http://www.e-jc.de/dwm/5.0/current/dwm-5.0-maximize_vert_horz.diff - diff --git a/dwm.suckless.org/patches/moveresize.md b/dwm.suckless.org/patches/moveresize.md @@ -1,11 +1,89 @@ -# MOVERESIZE +MOVERESIZE AND MAXIMIZE VERTICAL/HORIZONTAL PATCH +================================================= -## Description +Description +----------- +These patches provide helper functions for moving and resizing floating windows using keybindings. + +From dwm 6.0 onward the moveresize is aware of the screen sizes in a multi monitor setup. + +There is another implementation found below the download section. + +Configuration +------------- +This is a sample 'hjkl'-style configuration: + + { MODKEY, XK_a, moveresize, {.v = "-10x 0y 0w 0h" } }, + { MODKEY, XK_d, moveresize, {.v = "10x 0y 0w 0h" } }, + { MODKEY, XK_s, moveresize, {.v = "0x 10y 0w 0h" } }, + { MODKEY, XK_w, moveresize, {.v = "0x -10y 0w 0h" } }, + { MODKEY|ControlMask, XK_a, moveresize, {.v = "0X 0y 0w 0h" } }, + { MODKEY|ControlMask, XK_d, moveresize, {.v = "9000X 0y 0w 0h" } }, + { MODKEY|ControlMask, XK_s, moveresize, {.v = "0x 9000Y 0w 0h" } }, + { MODKEY|ControlMask, XK_w, moveresize, {.v = "0x 15Y 0w 0h" } }, + { MODKEY|ShiftMask, XK_a, moveresize, {.v = "0x 0y -10w 0h" } }, + { MODKEY|ShiftMask, XK_d, moveresize, {.v = "0x 0y 10w 0h" } }, + { MODKEY|ShiftMask, XK_s, moveresize, {.v = "0x 0y 0w 10h" } }, + { MODKEY|ShiftMask, XK_w, moveresize, {.v = "0x 0y 0w -10h" } }, + { MODKEY|ControlMask|ShiftMask, XK_h, togglehorizontalmax, NULL }, + { MODKEY|ControlMask|ShiftMask, XK_l, togglehorizontalmax, NULL }, + { MODKEY|ControlMask|ShiftMask, XK_j, toggleverticalmax, NULL }, + { MODKEY|ControlMask|ShiftMask, XK_k, toggleverticalmax, NULL }, + { MODKEY|ControlMask, XK_m, togglemaximize, {0} }, + + +Download +-------- + +6.0 + + * [dwm-6.0-moveresize.diff][9] + * [dwm-6.0-maximize_vert_horz.diff][10] + +5.0 + + * [dwm-5.0-moveresize.diff][7] + * [dwm-5.0-maximize_vert_horz.diff][8] + +4.6 + + * [dwm-4.6-moveresize.diff][5] + * [dwm-4.6-maximize_vert_horz.diff][6] + +4.5 + + * [dwm-4.5-moveresize.diff][3] + * [dwm-4.5-maximize_vert_horz.diff][4] + +4.4 + + * [dwm-4.4-moveresize.diff][1] + * [dwm-4.4-maximize_vert_horz.diff][2] + +Author +------ + * Jan Christoph Ebersbach - <jceb@e-jc.de> + +[1]: http://www.e-jc.de/dwm/dwm-4.4-moveresize.diff +[2]: http://www.e-jc.de/dwm/dwm-4.4-maximize_vert_horz.diff +[3]: http://www.e-jc.de/dwm/4.5/dwm-4.5-tip_ac233c362502-moveresize.diff +[4]: http://www.e-jc.de/dwm/4.5/dwm-4.5-tip_ac233c362502-maximize_vert_horz.diff +[5]: http://www.e-jc.de/dwm/4.6/current/dwm-4.6-moveresize.diff +[6]: http://www.e-jc.de/dwm/4.6/current/dwm-4.6-maximize_vert_horz.diff +[7]: http://www.e-jc.de/dwm/5.0/current/dwm-5.0-moveresize.diff +[8]: http://www.e-jc.de/dwm/5.0/current/dwm-5.0-maximize_vert_horz.diff +[9]: dwm-6.0-moveresize.diff +[10]: dwm-6.0-maximize_vert_horz.diff + +Description +----------- This changes allows you to move and resize dwm's clients using keyboard -bindings. See [historical patches](historical) for older versions. +bindings. -## Usage + +Usage +----- 1. Put the following `moveresize()` function somewhere in your `dwm.c`, **after** the line which includes the config.h file: @@ -50,7 +128,7 @@ replace the `if()` statement above with this code: if(m->lt[m->sellt]->arrange && !m->sel->isfloating) togglefloating(NULL); -## Mantainer +Mantainer +--------- * Claudio M. Alessi - <smoppy@gmail.com> -