sites

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

commit b402daf061c0bfbe4d66f971a259e8e70251c00f
parent f7511a002f6cf99b37c89a8059ded8c38692e171
Author: FRIGN <dev@frign.de>
Date:   Tue, 19 Jul 2016 10:46:28 +0200

dwm center patch: update

Diffstat:
Mdwm.suckless.org/patches/center.md | 13+++++++------
Adwm.suckless.org/patches/dwm-center-20160719-56a31dc.diff | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddwm.suckless.org/patches/historical/dwm-center-20130827-cdec978.diff | 58----------------------------------------------------------
3 files changed, 65 insertions(+), 64 deletions(-)

diff --git a/dwm.suckless.org/patches/center.md b/dwm.suckless.org/patches/center.md @@ -4,16 +4,17 @@ center Description ----------- -Adds an "iscentered" rule to automatically center clients on the current +Add an `iscentered` rule to automatically center clients on the current monitor. Download -------- -* [dwm-center-6.1.diff](dwm-center-6.1.diff) (2k) (20151114) -* [dwm-center-20130827-cdec978.diff](historical/dwm-center-20130827-cdec978.diff) (2k) (20140123) + * [dwm-center-6.1.diff](dwm-center-6.1.diff) + * [dwm-center-20160719-56a31dc.diff](dwm-center-20160719-56a31dc.diff) -Author ------- +Authors +------- -* [Chris Down](https://chrisdown.name) (cdown) <chris@chrisdown.name> + * Chris Down - <chris@chrisdown.name> + * Laslo Hunhold - <dev@frign.de> (git port) diff --git a/dwm.suckless.org/patches/dwm-center-20160719-56a31dc.diff b/dwm.suckless.org/patches/dwm-center-20160719-56a31dc.diff @@ -0,0 +1,58 @@ +diff --git a/config.def.h b/config.def.h +index fd77a07..5bf4860 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -26,9 +26,9 @@ static const Rule rules[] = { + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ +- /* class instance title tags mask isfloating monitor */ +- { "Gimp", NULL, NULL, 0, 1, -1 }, +- { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, ++ /* class instance title tags mask iscentered isfloating monitor */ ++ { "Gimp", NULL, NULL, 0, 0, 1, -1 }, ++ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 }, + }; + + /* layout(s) */ +diff --git a/dwm.c b/dwm.c +index b2bc9bd..72c9497 100644 +--- a/dwm.c ++++ b/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 isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + Client *next; + Client *snext; + Monitor *mon; +@@ -138,6 +138,7 @@ typedef struct { + const char *instance; + const char *title; + unsigned int tags; ++ int iscentered; + int isfloating; + int monitor; + } Rule; +@@ -298,6 +299,7 @@ applyrules(Client *c) + && (!r->class || strstr(class, r->class)) + && (!r->instance || strstr(instance, r->instance))) + { ++ c->iscentered = r->iscentered; + c->isfloating = r->isfloating; + c->tags |= r->tags; + for (m = mons; m && m->num != r->monitor; m = m->next); +@@ -1066,6 +1068,11 @@ manage(Window w, XWindowAttributes *wa) + && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); + c->bw = borderpx; + ++ if(c->iscentered) { ++ c->x = (c->mon->mw - WIDTH(c)) / 2; ++ c->y = (c->mon->mh - HEIGHT(c)) / 2; ++ } ++ + wc.border_width = c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); diff --git a/dwm.suckless.org/patches/historical/dwm-center-20130827-cdec978.diff b/dwm.suckless.org/patches/historical/dwm-center-20130827-cdec978.diff @@ -1,58 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 875885b..2e3a9fb 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -21,9 +21,9 @@ static const Rule rules[] = { - * WM_CLASS(STRING) = instance, class - * WM_NAME(STRING) = title - */ -- /* class instance title tags mask isfloating monitor */ -- { "Gimp", NULL, NULL, 0, True, -1 }, -- { "Firefox", NULL, NULL, 1 << 8, False, -1 }, -+ /* class instance title tags mask iscentered isfloating monitor */ -+ { "Gimp", NULL, NULL, 0, False, True, -1 }, -+ { "Firefox", NULL, NULL, 1 << 8, False, False, -1 }, - }; - - /* layout(s) */ -diff --git a/dwm.c b/dwm.c -index 1bbb4b3..a8a3356 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -91,7 +91,7 @@ struct Client { - int basew, baseh, incw, inch, maxw, maxh, minw, minh; - int bw, oldbw; - unsigned int tags; -- Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; -+ Bool isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen; - Client *next; - Client *snext; - Monitor *mon; -@@ -136,6 +136,7 @@ typedef struct { - const char *instance; - const char *title; - unsigned int tags; -+ Bool iscentered; - Bool isfloating; - int monitor; - } Rule; -@@ -294,6 +295,7 @@ applyrules(Client *c) { - && (!r->class || strstr(class, r->class)) - && (!r->instance || strstr(instance, r->instance))) - { -+ c->iscentered = r->iscentered; - c->isfloating = r->isfloating; - c->tags |= r->tags; - for(m = mons; m && m->num != r->monitor; m = m->next); -@@ -1038,6 +1040,11 @@ manage(Window w, XWindowAttributes *wa) { - && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); - c->bw = borderpx; - -+ if(c->iscentered) { -+ c->x = (c->mon->mw - WIDTH(c)) / 2; -+ c->y = (c->mon->mh - HEIGHT(c)) / 2; -+ } -+ - wc.border_width = c->bw; - XConfigureWindow(dpy, w, CWBorderWidth, &wc); - XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->rgb);