sites

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

commit b203793f6ff855dccce1ddff63ae298df030e4c8
parent 6d6c2112c68557be114f184d6bcade789713c0a2
Author: Jan Christoph Ebersbach <jceb@e-jc.de>
Date:   Sun, 31 Jul 2016 07:27:09 +0200

Update patch maximize

Diffstat:
Adwm.suckless.org/patches/dwm-maximize_vert_horz-20160731-56a31dc.diff | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/maximize.md | 2+-
2 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/dwm.suckless.org/patches/dwm-maximize_vert_horz-20160731-56a31dc.diff b/dwm.suckless.org/patches/dwm-maximize_vert_horz-20160731-56a31dc.diff @@ -0,0 +1,77 @@ +Author: Jan Christoph Ebersbach <jceb@e-jc.de> +URL: http://dwm.suckless.org/patches/maximize +These patches provide helper functions for moving and resizing floating windows +using keybindings. + +Index: dwm/dwm.c +=================================================================== +--- dwm/dwm.c.orig ++++ dwm/dwm.c +@@ -93,7 +93,7 @@ struct Client { + int basew, baseh, incw, inch, maxw, maxh, minw, minh; + int bw, oldbw; + unsigned int tags; +- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; ++ int ismax, wasfloating, isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + Client *next; + Client *snext; + Monitor *mon; +@@ -1075,6 +1075,8 @@ manage(Window w, XWindowAttributes *wa) + updatewmhints(c); + XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); + grabbuttons(c, 0); ++ c->wasfloating = 0; ++ c->ismax = 0; + if (!c->isfloating) + c->isfloating = c->oldstate = trans != None || c->isfixed; + if (c->isfloating) +Index: dwm/maximize.c +=================================================================== +--- /dev/null ++++ dwm/maximize.c +@@ -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/maximize.md b/dwm.suckless.org/patches/maximize.md @@ -18,7 +18,7 @@ Insert the bindings into the keys list. Here is an example: Download -------- -<!-- Author already emailed about uncleanliness of this patch --> +* [dwm-maximize_vert_horz-20160731-56a31dc.diff](dwm-maximize_vert_horz-20160731-56a31dc.diff) * [dwm-maximize_vert_horz-6.1.diff](dwm-maximize_vert_horz-6.1.diff) (Unclean patch) * [dwm-maximize_vert_horz-6.0.diff](dwm-maximize_vert_horz-6.0.diff)