--- a/config.h    2018-02-14 22:55:28.352889437 -0500
+++ b/config.h    2018-02-14 22:56:19.981887658 -0500
@@ -2,6 +2,7 @@

 /* appearance */
 static const unsigned int borderpx  = 1;        /* border pixel of windows */
+static const unsigned int gappx     = 18;       /* gap pixel between windows */
 static const unsigned int snap      = 32;       /* snap pixel */
 static const int showbar            = 1;        /* 0 means no bar */
 static const int topbar             = 1;        /* 0 means bottom bar */
--- a/dwm.c    2018-02-14 22:57:31.020885210 -0500
+++ b/dwm.c    2018-02-14 22:57:37.235884996 -0500
@@ -1674,7 +1674,7 @@ tagmon(const Arg *arg)
 void
 tile(Monitor *m)
 {
-    unsigned int i, n, h, mw, my, ty;
+    unsigned int i, n, h, mw, my, ty, ns;
     Client *c;

     for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
@@ -1682,23 +1682,28 @@ tile(Monitor *m)
         return;

     if (n > m->nmaster)
+    {
         mw = m->nmaster ? m->ww * m->mfact : 0;
-    else
+        ns = m->nmaster > 0 ? 2 : 1;
+    } else {
         mw = m->ww;
-    for (i = my = ty = 0, c = nexttiled(m->clients); c; c =
nexttiled(c->next), i++)
+        ns = 1;
+    }
+    for(i = 0, my = ty = gappx, 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);
-            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);
-            ty += HEIGHT(c);
+                 h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
+                 resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw)
- gappx*(5-ns)/2, h - (2*c->bw), False);
+                 my += HEIGHT(c) + gappx;
+        }
+        else {
+                 h = (m->wh - ty) / (n - i) - gappx;
+                 resize(c, m->wx + mw + gappx/ns, m->wy + ty, m->ww -
mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
+                 ty += HEIGHT(c) + gappx;
         }
 }

-void
-togglebar(const Arg *arg)
+    void
+togglebar(const Arg *are)
 {
     selmon->showbar = !selmon->showbar;
     updatebarpos(selmon);

Reply via email to