dwm-noxz

[fork] suckless dwm - personal fork
git clone https://noxz.tech/git/dwm-noxz.git
Log | Files | README | LICENSE

commit: 1d77a497c3020e33b6bec85be1647c95d40ff70a
parent: 765b660c8501f4e197ee90848537ce0debf7636b
author: Chris Noxz <chris@noxz.tech>
date:   Thu, 11 May 2023 14:33:55 +0200
Remove tiled layout
Mconfig.def.h3-
Mdwm.c70+++-----------------
2 files changed, 11 insertions(+), 62 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -79,14 +79,12 @@ static int resizehints          = 0;    /* 1 means respect size hints in tiled r
 static int i_basewidth          = 30;
 static int i_wmicon[]           = {4,0,3,3,8,4,3,3,0,8,3,3,4,8,3,3,8,8,3,3};
 static int i_nrowgrid[]         = {0,1,7,4,8,1,6,4,0,6,4,3,5,6,4,3,10,6,4,3};
-static int i_tile[]             = {0,1,8,4,0,6,8,3,9,1,5,2,9,4,5,2,9,7,5,2};
 static int i_monocle[]          = {0,1,4,1,10,1,4,1,0,8,4,1,10,8,4,1,0,2,1,2,13,2,1,2,0,6,1,2,13,6,1,2};
 static int i_float[]            = {0,1,10,2,0,3,3,3,4,4,10,5};
 
 static const Layout layouts[] = {
 	/* symbol     arrange function */
 	[LayoutGrid]                = { nrowgrid, i_nrowgrid, LENGTH(i_nrowgrid) }, /* default */
-	[LayoutTiled]               = { tile, i_tile, LENGTH(i_tile) },
 	[LayoutMonocle]             = { monocle, i_monocle, LENGTH(i_monocle) },
 	[LayoutFloating]            = { NULL, i_float, LENGTH(i_float) },           /* no layout function means floating behavior */
 };
@@ -173,7 +171,6 @@ static Command commands[] = {
 	{ "set status ...",     setstatus,      {.i = DispCmdLine} },
 
 	{ "set layout grid",    setlayout,      {.v = &layouts[LayoutGrid]} },
-	{ "set layout tiled",   setlayout,      {.v = &layouts[LayoutTiled]} },
 	{ "set layout floating",setlayout,      {.v = &layouts[LayoutFloating]} },
 	{ "set layout monocle", setlayout,      {.v = &layouts[LayoutMonocle]} },
 	{ "toggle monocle",     togglelayout,   {.v = &layouts[LayoutMonocle]} },
diff --git a/dwm.c b/dwm.c
@@ -63,7 +63,7 @@
 
 /* enums */
 enum { DispUi, DispCmdLine }; /* dispatch types */
-enum { LayoutGrid, LayoutTiled, LayoutMonocle, LayoutFloating }; /* layouts, first is default */
+enum { LayoutGrid, LayoutMonocle, LayoutFloating }; /* layouts, first is default */
 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
 enum { SchemeNorm, SchemeSel, SchemeTagsNorm, SchemeTagsIncl, SchemeTagsSel,
        SchemeLayout, SchemeTitleNorm, SchemeTitleSel, SchemeWMIcon,
@@ -213,7 +213,7 @@ static void manage(Window w, XWindowAttributes *wa);
 static void maprequest(XEvent *e);
 static void monocle(Monitor *m);
 static void movemouse(const Arg *arg);
-static Client *nexttiled(Client *c);
+static Client *nextinstack(Client *c);
 static void pop(Client *);
 static void propertynotify(XEvent *e);
 static void quit(const Arg *arg);
@@ -245,7 +245,6 @@ static void sigchld(int unused);
 static void spawn(const Arg *arg);
 static void tag(const Arg *arg);
 static void tagmon(const Arg *arg);
-static void tile(Monitor *);
 static void nrowgrid(Monitor *);
 static void togglebar(const Arg *arg);
 static void togglefloating(const Arg *arg);
@@ -1391,7 +1390,7 @@ void
 monocle(Monitor *m)
 {
 	Client *c;
-	for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
+	for (c = nextinstack(m->clients); c; c = nextinstack(c->next))
 		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
 }
 
@@ -1456,7 +1455,7 @@ movemouse(const Arg *arg)
 }
 
 Client *
-nexttiled(Client *c)
+nextinstack(Client *c)
 {
 	for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
 	return c;
@@ -1543,7 +1542,7 @@ resizeclient(Client *c, int x, int y, int w, int h)
 	c->oldw = c->w; c->w = wc.width = w;
 	c->oldh = c->h; c->h = wc.height = h;
 	wc.border_width = c->bw;
-	if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
+	if (((nextinstack(c->mon->clients) == c && !nextinstack(c->next))
 		|| &monocle == c->mon->lt[c->mon->sellt]->arrange)
 		&& !c->isfullscreen
 		&& !c->isfloating
@@ -1698,7 +1697,7 @@ rotatestack(const Arg *arg)
 		return;
 	f = selmon->sel;
 	if (arg->i > 0) {
-		for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next));
+		for (c = nextinstack(selmon->clients); c && nextinstack(c->next); c = nextinstack(c->next));
 		if (c){
 			detach(c);
 			attach(c);
@@ -1706,7 +1705,7 @@ rotatestack(const Arg *arg)
 			attachstack(c);
 		}
 	} else {
-		if ((c = nexttiled(selmon->clients))){
+		if ((c = nextinstack(selmon->clients))){
 			detach(c);
 			enqueue(c);
 			detachstack(c);
@@ -2133,53 +2132,6 @@ getgap(Monitor *m, unsigned int n, unsigned int *g, unsigned int r, unsigned int
 	*g = (m->pertag->enablegaps[m->pertag->curtag] && n > 0) ? m->gap : 0;
 }
 
-void
-tile(Monitor *m)
-{
-	unsigned int n, ri = 0, ci = 0;             /* counters */
-	unsigned int cx, cy, cw, ch, cg;            /* client geometry */
-	unsigned int uw = 0, uh = 0;                /* utilization trackers */
-	unsigned int cols, rows, mw = m->ww;
-	Client *c;
-
-	for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
-	if (n == 0)
-		return;
-
-	/* calculate rows and cols, never allow empty rows */
-	/* handle bounds for nmaster */
-	cols = m->nmaster = m->pertag->nmasters[m->pertag->curtag] = MAX(MIN(m->nmaster, n), 1);
-	rows = n - cols;
-
-	getgap(m, n, &cg, rows, MAX(3, cols));
-
-	if (n > cols)
-		mw = cols ? mw * (double)MAX(2, cols) / (double)MAX(3, cols + 1) : 0;
-
-	/* define initials */
-	cy = m->wy + cg;
-	ch = m->wh - 2*cg;
-	uw = cx = cw = 0;
-
-	for (c = nexttiled(m->clients); c; c = nexttiled(c->next), ci++) {
-		if (ci == cols) {
-			cx = m->wx + uw + cg;
-			cw = m->ww - cx - cg;
-		}
-		if (ci < cols) {
-			cx = m->wx + uw + cg;
-			cw = ((mw - 2*cg) - uw - (cg * (cols - ci - 1))) / (cols - ci);
-			uw += cw + cg;
-		} else {
-			cy = m->wy + uh + cg;
-			ch = ((m->wh - 2*cg) - uh - (cg * (rows - ri - 1))) / (rows - ri);
-			uh += ch + cg;
-			ri++;
-		}
-		resize(c, cx, cy, cw - (2*c->bw), ch - (2*c->bw), 0);
-	}
-}
-
 void
 nrowgrid(Monitor *m)
 {
@@ -2189,7 +2141,7 @@ nrowgrid(Monitor *m)
 	unsigned int cols, rows;
 	Client *c;
 
-	for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+	for (n = 0, c = nextinstack(m->clients); c; c = nextinstack(c->next), n++);
 	if (n == 0)
 		return;
 
@@ -2208,7 +2160,7 @@ nrowgrid(Monitor *m)
 	ch = (m->wh - 2*cg - (cg * (rows - 1))) / rows;
 	uh = ch + cg;
 
-	for (c = nexttiled(m->clients); c; c = nexttiled(c->next), ci++) {
+	for (c = nextinstack(m->clients); c; c = nextinstack(c->next), ci++) {
 		if (ci == cols) {
 			uw = 0;
 			ci = 0;
@@ -2716,8 +2668,8 @@ zoom(const Arg *arg)
 	if (!selmon->lt[selmon->sellt]->arrange
 	|| (selmon->sel && selmon->sel->isfloating))
 		return;
-	if (c == nexttiled(selmon->clients))
-		if (!c || !(c = nexttiled(c->next)))
+	if (c == nextinstack(selmon->clients))
+		if (!c || !(c = nextinstack(c->next)))
 			return;
 	pop(c);
 }