sites

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

dwm-ru_deck-6.2.diff (2574B)


      1 diff -up a/config.def.h b/config.def.h
      2 --- a/config.def.h	2019-07-24 08:59:14.429282151 +0200
      3 +++ b/config.def.h	2019-07-24 10:18:12.954351748 +0200
      4 @@ -42,6 +42,7 @@ static const Layout layouts[] = {
      5  	{ "[]=",      tile },    /* first entry is default */
      6  	{ "><>",      NULL },    /* no layout function means floating behavior */
      7  	{ "[M]",      monocle },
      8 +	{ "[D]",      deck },
      9  };
     10  
     11  /* key definitions */
     12 @@ -77,6 +78,7 @@ static Key keys[] = {
     13  	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
     14  	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
     15  	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
     16 +	{ MODKEY,                       XK_c,      setlayout,      {.v = &layouts[3]} },
     17  	{ MODKEY,                       XK_space,  setlayout,      {0} },
     18  	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
     19  	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
     20 Only in b: config.def.h.orig
     21 diff -up a/dwm.c b/dwm.c
     22 --- a/dwm.c	2019-07-24 08:59:14.432615503 +0200
     23 +++ b/dwm.c	2019-07-24 10:20:33.852636486 +0200
     24 @@ -158,6 +158,7 @@ static void configure(Client *c);
     25  static void configurenotify(XEvent *e);
     26  static void configurerequest(XEvent *e);
     27  static Monitor *createmon(void);
     28 +static void deck(Monitor *m);
     29  static void destroynotify(XEvent *e);
     30  static void detach(Client *c);
     31  static void detachstack(Client *c);
     32 @@ -658,6 +659,39 @@ destroynotify(XEvent *e)
     33  }
     34  
     35  void
     36 +deck(Monitor *m) {
     37 +	unsigned int i, n, h, mw, my, ns;
     38 +	Client *c;
     39 +
     40 +	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
     41 +	if(n == 0)
     42 +		return;
     43 +	if(n == 1){
     44 +		c = nexttiled(m->clients);
     45 +		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
     46 +		return;
     47 +	}
     48 +
     49 +	if(n > m->nmaster) {
     50 +		mw = m->nmaster ? m->ww * m->mfact : 0;
     51 +		ns = m->nmaster > 0 ? 2 : 1;
     52 +		snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
     53 +	} else {
     54 +		mw = m->ww;
     55 +		ns = 1;
     56 +	}
     57 +	for(i = 0, my = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
     58 +		if(i < m->nmaster) {
     59 +			h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
     60 +			resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx*(5-ns)/2, h - (2*c->bw), False);
     61 +			if (my + HEIGHT(c) + m->gappx < m->wh)
     62 +				my += HEIGHT(c) + m->gappx;
     63 +		}
     64 +		else
     65 +			resize(c, m->wx + mw + m->gappx/ns, m->wy + m->gappx, m->ww - mw - (2*c->bw) - m->gappx*(5-ns)/2, m->wh - (2*c->bw) - 2*m->gappx, False);
     66 +}
     67 +
     68 +void
     69  detach(Client *c)
     70  {
     71  	Client **tc;