Login
Immutable PageDiscussionInfoAttachments
attachment:dwm-6.0-moderatetile.diff of clear/misc

MMA

Attachment 'dwm-6.0-moderatetile.diff'

Download

   1 diff -u dwm-6.0/config.def.h dwm-6.0-moderatetile/config.def.h
   2 --- dwm-6.0/config.def.h	2011-12-20 00:02:46.000000000 +0900
   3 +++ dwm-6.0-moderatetile/config.def.h	2012-05-10 03:24:49.235208899 +0900
   4 @@ -24,6 +24,8 @@
   5  
   6  /* layout(s) */
   7  static const float mfact      = 0.55; /* factor of master area size [0.05..0.95] */
   8 +static const float hmargin    = 0.20; /* horizontal margin */
   9 +static const float vmargin    = 0.10; /* vertical margin */
  10  static const int nmaster      = 1;    /* number of clients in master area */
  11  static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
  12  
  13 @@ -32,6 +34,7 @@
  14  	{ "[]=",      tile },    /* first entry is default */
  15  	{ "><>",      NULL },    /* no layout function means floating behavior */
  16  	{ "[M]",      monocle },
  17 +	{ "()-",      moderatetile },
  18  };
  19  
  20  /* key definitions */
  21 @@ -66,6 +69,7 @@
  22  	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
  23  	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
  24  	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
  25 +	{ MODKEY|ShiftMask,             XK_t,      setlayout,      {.v = &layouts[3]} },
  26  	{ MODKEY,                       XK_space,  setlayout,      {0} },
  27  	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
  28  	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
  29 diff -u dwm-6.0/dwm.c dwm-6.0-moderatetile/dwm.c
  30 --- dwm-6.0/dwm.c	2011-12-20 00:02:46.000000000 +0900
  31 +++ dwm-6.0-moderatetile/dwm.c	2012-05-10 02:56:13.537836916 +0900
  32 @@ -199,6 +199,7 @@
  33  static void manage(Window w, XWindowAttributes *wa);
  34  static void mappingnotify(XEvent *e);
  35  static void maprequest(XEvent *e);
  36 +static void moderatetile(Monitor *m);
  37  static void monocle(Monitor *m);
  38  static void motionnotify(XEvent *e);
  39  static void movemouse(const Arg *arg);
  40 @@ -1190,6 +1191,46 @@
  41  }
  42  
  43  void
  44 +moderatetile(Monitor *m) {
  45 +	unsigned int i, n, h, mw, mx, my, ty;
  46 +	Client *c;
  47 +
  48 +	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
  49 +	if(n == 0)
  50 +		return;
  51 +
  52 +	if(n > m->nmaster) {
  53 +		mw = m->nmaster ? m->ww * m->mfact : 0;
  54 +		mx = 0;
  55 +	}
  56 +	else {
  57 +		mw = m->ww;
  58 +		mx = m->ww * hmargin / 2;
  59 +	}
  60 +	for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
  61 +		if(i < m->nmaster) {
  62 +			if(n == 1 || m->nmaster == 1) {
  63 +				my = m->wh * vmargin / 2;
  64 +				h = m->wh - 2 * my;
  65 +			}
  66 +			else
  67 +				h = (m->wh - my) / (MIN(n, m->nmaster) - i);
  68 +			resize(c, m->wx + mx, m->wy + my, mw - 2 * mx - (2*c->bw), h - (2*c->bw), False);
  69 +			my += HEIGHT(c);
  70 +		}
  71 +		else {
  72 +			if(n - m->nmaster == 1) {
  73 +				ty = m->wh * vmargin / 2;
  74 +				h = m->wh - 2 * ty;
  75 +			}
  76 +			else
  77 +				h = (m->wh - ty) / (n - i);
  78 +			resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
  79 +			ty += HEIGHT(c);
  80 +		}
  81 +}
  82 +
  83 +void
  84  monocle(Monitor *m) {
  85  	unsigned int n = 0;
  86  	Client *c;

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2021-03-03 17:30:02, 2.9 KB) [[attachment:dwm-6.0-moderatetile.diff]]
  • [get | view] (2021-03-03 17:30:02, 1.5 KB) [[attachment:dwm-6.0-rotate.diff]]
  • [get | view] (2021-03-03 17:30:02, 1.5 KB) [[attachment:dwm-6.0-statuscolor.diff]]
  • [get | view] (2021-03-03 17:30:02, 3.4 KB) [[attachment:now_implementing.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.