sites

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

dwm-columns-6.0.diff (2367B)


      1 diff -up dwm_orig_src/config.def.h dwm-6.0/config.def.h
      2 --- dwm_orig_src/config.def.h	2012-08-25 12:34:20.847202795 -0400
      3 +++ dwm-6.0/config.def.h	2012-08-25 11:58:15.210591031 -0400
      4 @@ -32,6 +32,7 @@ static const Layout layouts[] = {
      5  	{ "[]=",      tile },    /* first entry is default */
      6  	{ "><>",      NULL },    /* no layout function means floating behavior */
      7  	{ "[M]",      monocle },
      8 +	{ "|||",      col },
      9  };
     10  
     11  /* key definitions */
     12 @@ -66,6 +67,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 diff -up dwm_orig_src/dwm.c dwm-6.0/dwm.c
     21 --- dwm_orig_src/dwm.c	2012-08-25 12:34:20.847202795 -0400
     22 +++ dwm-6.0/dwm.c	2012-08-25 12:05:54.180592952 -0400
     23 @@ -167,6 +167,7 @@ static void cleanup(void);
     24  static void cleanupmon(Monitor *mon);
     25  static void clearurgent(Client *c);
     26  static void clientmessage(XEvent *e);
     27 +static void col(Monitor *);
     28  static void configure(Client *c);
     29  static void configurenotify(XEvent *e);
     30  static void configurerequest(XEvent *e);
     31 @@ -1702,6 +1703,32 @@ textnw(const char *text, unsigned int le
     32  }
     33  
     34  void
     35 +col(Monitor *m) {
     36 +	unsigned int i, n, h, w, x, y,mw;
     37 +	Client *c;
     38 +
     39 +	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
     40 +	if(n == 0)
     41 +		return;
     42 +        if(n > m->nmaster)
     43 +                mw = m->nmaster ? m->ww * m->mfact : 0;
     44 +        else
     45 +                mw = m->ww;
     46 +	for(i = x = y = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
     47 +		if(i < m->nmaster) {
     48 +			 w = (mw - x) / (MIN(n, m->nmaster)-i);
     49 +                         resize(c, x + m->wx, m->wy, w - (2*c->bw), m->wh - (2*c->bw), False);
     50 +			x += WIDTH(c);
     51 +		}
     52 +		else {
     53 +			h = (m->wh - y) / (n - i);
     54 +			resize(c, x + m->wx, m->wy + y, m->ww - x  - (2*c->bw), h - (2*c->bw), False);
     55 +			y += HEIGHT(c);
     56 +		}
     57 +	}
     58 +}
     59 +
     60 +void
     61  tile(Monitor *m) {
     62  	unsigned int i, n, h, mw, my, ty;
     63  	Client *c;