commit 7de7bdefe46cb6b40adbe7b0138a214539d76e64
parent 82fe6ef3538c9a1e2db214b7114bac133630d5ed
Author: Platon Ryzhikov <ihummer63@yandex.ru>
Date: Tue, 9 Jan 2018 22:27:33 +0300
Patch to use dwm with external panel
Diffstat:
2 files changed, 94 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/freespace/dwm-freespace-20180109-db22360.diff b/dwm.suckless.org/patches/freespace/dwm-freespace-20180109-db22360.diff
@@ -0,0 +1,65 @@
+diff --git a/config.def.h b/config.def.h
+index a9ac303..eb22d92 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -1,6 +1,7 @@
+ /* See LICENSE file for copyright and license details. */
+
+ /* appearance */
++static const unsigned int panel[] = {30, 0, 0, 0};//positions: 0-top panel, 1-bottom panel, 2-left panel, 3-right panel
+ static const unsigned int borderpx = 1; /* border pixel of windows */
+ static const unsigned int snap = 32; /* snap pixel */
+ static const int showbar = 1; /* 0 means no bar */
+diff --git a/dwm.c b/dwm.c
+index ec6a27c..91be0cc 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -1113,7 +1113,7 @@ monocle(Monitor *m)
+ if (n > 0) /* override layout symbol */
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
+ 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, 0);
++ 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);
+ }
+
+ void
+@@ -1169,14 +1169,14 @@ movemouse(const Arg *arg)
+
+ nx = ocx + (ev.xmotion.x - x);
+ ny = ocy + (ev.xmotion.y - y);
+- if (abs(selmon->wx - nx) < snap)
+- nx = selmon->wx;
+- else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap)
+- nx = selmon->wx + selmon->ww - WIDTH(c);
+- if (abs(selmon->wy - ny) < snap)
+- ny = selmon->wy;
+- else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap)
+- ny = selmon->wy + selmon->wh - HEIGHT(c);
++ if (abs(selmon->wx + panel[2] - nx) < snap)
++ nx = selmon->wx + panel[2];
++ else if (abs((selmon->wx + selmon->ww - panel[3]) - (nx + WIDTH(c))) < snap)
++ nx = selmon->wx + selmon->ww - WIDTH(c) - panel[3];
++ if (abs(selmon->wy + panel[1] - ny) < snap)
++ ny = selmon->wy + panel[1];
++ else if (abs((selmon->wy + selmon->wh - panel[0]) - (ny + HEIGHT(c))) < snap)
++ ny = selmon->wy + selmon->wh - HEIGHT(c) - panel[0];
+ if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
+ && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
+ togglefloating(NULL);
+@@ -1687,12 +1687,12 @@ tile(Monitor *m)
+ mw = m->ww;
+ for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ 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), 0);
++ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - panel[0];
++ resize(c, m->wx + panel[2], m->wy + my + panel[1], mw - (c->bw), h - (c->bw) - panel[1], 0);
+ 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), 0);
++ h = (m->wh - ty) / (n - i) - panel[0];
++ 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);
+ ty += HEIGHT(c);
+ }
+ }
diff --git a/dwm.suckless.org/patches/freespace/index.md b/dwm.suckless.org/patches/freespace/index.md
@@ -0,0 +1,29 @@
+freespace
+=========
+
+Description
+-----------
+
+New variable panel[4] saves space at the borders of the screen for the external panel.
+
++----------------+-+
+| | panel[0] | |
++-+--------------+-+
+| | | |
+|2| |3|
+| | | |
++-+--------------+-+
+| | panel[1] | |
++----------------+-+
+
+In tiled and monocle layouts this space becomes borders of the windows; in floating layout windows attach to these borders
+
+Download
+--------
+
+* [dwm-freespace-20180109-db22360.diff](dwm-freespace-20180109-db22360.diff)
+
+Author
+------
+
+* Platon Ryzhikov - <ihummer63@yandex.ru>