-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path03-noborder.diff
86 lines (80 loc) · 2.58 KB
/
03-noborder.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
diff -up a/dwm.c b/dwm.c
--- a/dwm.c 2012-07-17 17:29:20.569822735 +1000
+++ b/dwm.c 2012-07-17 17:31:51.695670682 +1000
@@ -1227,10 +1227,20 @@ maprequest(XEvent *e) {
void
monocle(Monitor *m) {
+ unsigned int n = 0, r = 0;
Client *c;
- for(c = nexttiled(m->clients); c; c = nexttiled(c->next))
- resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False);
+ for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
+ /* remove border when in monocle layout */
+ if(c->bw) {
+ c->oldbw = c->bw;
+ c->bw = 0;
+ r = 1;
+ }
+ resize(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw), False);
+ if(r)
+ resizeclient(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw));
+ }
}
void
@@ -1746,7 +1756,7 @@ textnw(const char *text, unsigned int le
void
tile(Monitor *m) {
- unsigned int i, n, h, mw, my, ty;
+ unsigned int i, n, h, mw, my, ty, r;
Client *c;
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
@@ -1757,17 +1767,36 @@ tile(Monitor *m) {
mw = m->nmaster ? m->ww * m->mfact : 0;
else
mw = m->ww;
- for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++, r = 0) {
+ if(n == 1) {
+ if (c->bw) {
+ /* remove border when only one window is on the current tag */
+ c->oldbw = c->bw;
+ c->bw = 0;
+ r = 1;
+ }
+ }
+ else if(!c->bw && c->oldbw) {
+ /* restore border when more than one window is displayed */
+ c->bw = c->oldbw;
+ c->oldbw = 0;
+ r = 1;
+ }
if(i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
+ if(r)
+ resizeclient(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw));
my += HEIGHT(c);
}
else {
h = (m->wh - ty) / (n - i);
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
+ if(r)
+ resizeclient(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw));
ty += HEIGHT(c);
}
+ }
}
void
@@ -1784,6 +1813,12 @@ togglefloating(const Arg *arg) {
return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if(selmon->sel->isfloating)
+ /* restore border when moving window into floating mode */
+ if(!selmon->sel->bw && selmon->sel->oldbw) {
+ selmon->sel->bw = selmon->sel->oldbw;
+ selmon->sel->oldbw = 0;
+ }
+ if(selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
selmon->sel->w, selmon->sel->h, False);
arrange(selmon);