dwm-freespace-20180109-db22360.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-freespace-20180109-db22360.diff (2887B)
---
1 diff --git a/config.def.h b/config.def.h
2 index a9ac303..eb22d92 100644
3 --- a/config.def.h
4 +++ b/config.def.h
5 @@ -1,6 +1,7 @@
6 /* See LICENSE file for copyright and license details. */
7
8 /* appearance */
9 +static const unsigned int panel[] = {30, 0, 0, 0};//positions: 0-top panel, 1-bottom panel, 2-left panel, 3-right panel
10 static const unsigned int borderpx = 1; /* border pixel of windows */
11 static const unsigned int snap = 32; /* snap pixel */
12 static const int showbar = 1; /* 0 means no bar */
13 diff --git a/dwm.c b/dwm.c
14 index ec6a27c..91be0cc 100644
15 --- a/dwm.c
16 +++ b/dwm.c
17 @@ -1113,7 +1113,7 @@ monocle(Monitor *m)
18 if (n > 0) /* override layout symbol */
19 snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
20 for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
21 - resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
22 + resize(c, m->wx + panel[2], m->wy + panel[1] , m->ww - 2 * c->bw - panel[3] - panel[2], m->wh - 2 * c->bw - panel[0] - panel[1], 0);
23 }
24
25 void
26 @@ -1169,14 +1169,14 @@ movemouse(const Arg *arg)
27
28 nx = ocx + (ev.xmotion.x - x);
29 ny = ocy + (ev.xmotion.y - y);
30 - if (abs(selmon->wx - nx) < snap)
31 - nx = selmon->wx;
32 - else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap)
33 - nx = selmon->wx + selmon->ww - WIDTH(c);
34 - if (abs(selmon->wy - ny) < snap)
35 - ny = selmon->wy;
36 - else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap)
37 - ny = selmon->wy + selmon->wh - HEIGHT(c);
38 + if (abs(selmon->wx + panel[2] - nx) < snap)
39 + nx = selmon->wx + panel[2];
40 + else if (abs((selmon->wx + selmon->ww - panel[3]) - (nx + WIDTH(c))) < snap)
41 + nx = selmon->wx + selmon->ww - WIDTH(c) - panel[3];
42 + if (abs(selmon->wy + panel[1] - ny) < snap)
43 + ny = selmon->wy + panel[1];
44 + else if (abs((selmon->wy + selmon->wh - panel[0]) - (ny + HEIGHT(c))) < snap)
45 + ny = selmon->wy + selmon->wh - HEIGHT(c) - panel[0];
46 if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
47 && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
48 togglefloating(NULL);
49 @@ -1687,12 +1687,12 @@ tile(Monitor *m)
50 mw = m->ww;
51 for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
52 if (i < m->nmaster) {
53 - h = (m->wh - my) / (MIN(n, m->nmaster) - i);
54 - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
55 + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - panel[0];
56 + resize(c, m->wx + panel[2], m->wy + my + panel[1], mw - (c->bw), h - (c->bw) - panel[1], 0);
57 my += HEIGHT(c);
58 } else {
59 - h = (m->wh - ty) / (n - i);
60 - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
61 + h = (m->wh - ty) / (n - i) - panel[0];
62 + resize(c, m->wx + mw + panel[2] , m->wy + ty + panel[1], m->ww - mw - (c->bw) - panel[2] - panel[3], h - (c->bw) - panel[1], 0);
63 ty += HEIGHT(c);
64 }
65 }