dwm-center-6.1.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-center-6.1.diff (2038B) | |
--- | |
1 diff --git a/config.def.h b/config.def.h | |
2 index 7054c06..e0cdcf3 100644 | |
3 --- a/config.def.h | |
4 +++ b/config.def.h | |
5 @@ -24,9 +24,9 @@ static const Rule rules[] = { | |
6 * WM_CLASS(STRING) = instance, class | |
7 * WM_NAME(STRING) = title | |
8 */ | |
9 - /* class instance title tags mask isfloating … | |
10 - { "Gimp", NULL, NULL, 0, 1, … | |
11 - { "Firefox", NULL, NULL, 1 << 8, 0, … | |
12 + /* class instance title tags mask iscentered … | |
13 + { "Gimp", NULL, NULL, 0, 0, … | |
14 + { "Firefox", NULL, NULL, 1 << 8, 0, … | |
15 }; | |
16 | |
17 /* layout(s) */ | |
18 diff --git a/dwm.c b/dwm.c | |
19 index 0362114..4aaaa60 100644 | |
20 --- a/dwm.c | |
21 +++ b/dwm.c | |
22 @@ -92,7 +92,7 @@ struct Client { | |
23 int basew, baseh, incw, inch, maxw, maxh, minw, minh; | |
24 int bw, oldbw; | |
25 unsigned int tags; | |
26 - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfull… | |
27 + int isfixed, iscentered, isfloating, isurgent, neverfocus, olds… | |
28 Client *next; | |
29 Client *snext; | |
30 Monitor *mon; | |
31 @@ -137,6 +137,7 @@ typedef struct { | |
32 const char *instance; | |
33 const char *title; | |
34 unsigned int tags; | |
35 + int iscentered; | |
36 int isfloating; | |
37 int monitor; | |
38 } Rule; | |
39 @@ -296,6 +297,7 @@ applyrules(Client *c) | |
40 && (!r->class || strstr(class, r->class)) | |
41 && (!r->instance || strstr(instance, r->instance))) | |
42 { | |
43 + c->iscentered = r->iscentered; | |
44 c->isfloating = r->isfloating; | |
45 c->tags |= r->tags; | |
46 for (m = mons; m && m->num != r->monitor; m = m… | |
47 @@ -1063,6 +1065,11 @@ manage(Window w, XWindowAttributes *wa) | |
48 && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? … | |
49 c->bw = borderpx; | |
50 | |
51 + if(c->iscentered) { | |
52 + c->x = (c->mon->mw - WIDTH(c)) / 2; | |
53 + c->y = (c->mon->mh - HEIGHT(c)) / 2; | |
54 + } | |
55 + | |
56 wc.border_width = c->bw; | |
57 XConfigureWindow(dpy, w, CWBorderWidth, &wc); | |
58 XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->pix); |