dwm-deck-tilegap-6.1.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-deck-tilegap-6.1.diff (1700B)
       ---
            1 From a9e442ec18683e2255ffef74404c283bbb0b6381 Mon Sep 17 00:00:00 2001
            2 From: aleks <aleks.stier@icloud.com>
            3 Date: Thu, 23 May 2019 23:27:59 +0200
            4 Subject: [PATCH] Make deck-patch work with the tilegap-patch
            5 
            6 Apply this patch on top of the deck-patch to make it work with the
            7 tilegap-patch.
            8 ---
            9  dwm.c | 18 ++++++++++--------
           10  1 file changed, 10 insertions(+), 8 deletions(-)
           11 
           12 diff --git a/dwm.c b/dwm.c
           13 index 5b68242..1c17891 100644
           14 --- a/dwm.c
           15 +++ b/dwm.c
           16 @@ -656,7 +656,7 @@ createmon(void)
           17  
           18  void
           19  deck(Monitor *m) {
           20 -        unsigned int i, n, h, mw, my;
           21 +        unsigned int i, n, h, mw, my, ns;
           22          Client *c;
           23  
           24          for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
           25 @@ -665,18 +665,20 @@ deck(Monitor *m) {
           26  
           27          if(n > m->nmaster) {
           28                  mw = m->nmaster ? m->ww * m->mfact : 0;
           29 +                ns = m->nmaster > 0 ? 2 : 1;
           30                  snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
           31 -        }
           32 -        else
           33 +        } else {
           34                  mw = m->ww;
           35 -        for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
           36 +                ns = 1;
           37 +        }
           38 +        for(i = 0, my = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
           39                  if(i < m->nmaster) {
           40 -                        h = (m->wh - my) / (MIN(n, m->nmaster) - i);
           41 -                        resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
           42 -                        my += HEIGHT(c);
           43 +                        h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
           44 +                        resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
           45 +                        my += HEIGHT(c) + gappx;
           46                  }
           47                  else
           48 -                        resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
           49 +                        resize(c, m->wx + mw + gappx/ns, m->wy + gappx, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, m->wh - (2*c->bw) - 2*gappx, False);
           50  }
           51  
           52  void
           53 -- 
           54 2.21.0
           55