sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-singularbordersbar-6.2.diff (2518B)


      1 From f67d4db0bcef0eb4f601cd25995fd964d60b2a2d Mon Sep 17 00:00:00 2001
      2 From: aleks <aleks.stier@icloud.com>
      3 Date: Wed, 27 Jan 2021 16:52:55 +0100
      4 Subject: [PATCH] [dwm][patch] apply singularbordersbar
      5 
      6 `singularbordersbar` changes the way DWM handles the borders. Firstly,
      7 borders against the left, right, top and bottom screen-edges are removed
      8 (they are placed off-screen) and secondly, borders between clients now
      9 overlap eachother. A border between the clients and the bar is also
     10 created.
     11 ---
     12  dwm.c | 24 +++++++++++++++++++-----
     13  1 file changed, 19 insertions(+), 5 deletions(-)
     14 
     15 diff --git a/dwm.c b/dwm.c
     16 index 4465af1..d359d0a 100644
     17 --- a/dwm.c
     18 +++ b/dwm.c
     19 @@ -205,6 +205,7 @@ static void setup(void);
     20  static void seturgent(Client *c, int urg);
     21  static void showhide(Client *c);
     22  static void sigchld(int unused);
     23 +static int singularborder_baradjustment(Client *c);
     24  static void spawn(const Arg *arg);
     25  static void tag(const Arg *arg);
     26  static void tagmon(const Arg *arg);
     27 @@ -1112,7 +1113,8 @@ monocle(Monitor *m)
     28  	if (n > 0) /* override layout symbol */
     29  		snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
     30  	for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
     31 -		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
     32 +		resize(c, m->wx - c->bw, m->wy - singularborder_baradjustment(c),
     33 +			m->ww, m->wh - c->bw * m->showbar, False);
     34  }
     35  
     36  void
     37 @@ -1636,6 +1638,12 @@ sigchld(int unused)
     38  	while (0 < waitpid(-1, NULL, WNOHANG));
     39  }
     40  
     41 +int
     42 +singularborder_baradjustment(Client *c)
     43 +{
     44 +	return c->bw * !(c->mon->showbar && topbar);
     45 +}
     46 +
     47  void
     48  spawn(const Arg *arg)
     49  {
     50 @@ -1687,12 +1695,18 @@ tile(Monitor *m)
     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 -			my += HEIGHT(c);
     56 +			if (n == 1)
     57 +				resize(c, m->wx - c->bw, m->wy - singularborder_baradjustment(c),
     58 +					m->ww, m->wh - c->bw * m->showbar, False);
     59 +			else
     60 +				resize(c, m->wx - c->bw, m->wy + my - singularborder_baradjustment(c),
     61 +					mw - c->bw, h - c->bw * m->showbar, False);
     62 +			my += HEIGHT(c) - c->bw;
     63  		} else {
     64  			h = (m->wh - ty) / (n - i);
     65 -			resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
     66 -			ty += HEIGHT(c);
     67 +			resize(c, m->wx + mw - c->bw, m->wy + ty - singularborder_baradjustment(c),
     68 +				m->ww - mw, h - c->bw * m->showbar, False);
     69 +			ty += HEIGHT(c) - c->bw;
     70  		}
     71  }
     72  
     73 -- 
     74 2.30.0
     75