[wiki] [official] changed dwm/patches/dwm-5.2-gaplessgrid.diff || joten

From: <hg_AT_suckless.org>
Date: Mon, 20 Oct 2008 21:38:49 +0100 (BST)

changeset: 167:8e9929fe55a5
tag: tip
user: joten_AT_localhost.localdomain
date: Mon Oct 20 22:33:34 2008 +0200
files: dwm/patches/dwm-5.2-gaplessgrid.diff dwm/patches/gaplessgrid.md
description:
changed dwm/patches/dwm-5.2-gaplessgrid.diff
changed dwm/patches/gaplessgrid.md


diff -r 647189e9bab6 -r 8e9929fe55a5 dwm/patches/dwm-5.2-gaplessgrid.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm/patches/dwm-5.2-gaplessgrid.diff Mon Oct 20 22:33:34 2008 +0200
_AT_@ -0,0 +1,59 @@
+diff -up dwm-5.2-original/config.def.h dwm-5.2-modified/config.def.h
+--- dwm-5.2-original/config.def.h 2008-09-09 21:46:17.000000000 +0200
++++ dwm-5.2-modified/config.def.h 2008-10-20 20:07:42.000000000 +0200
+_AT_@ -28,11 +28,13 @@ static Rule rules[] = {
+ static float mfact = 0.55; /* factor of master area size [0.05..0.95] */
+ static Bool resizehints = True; /* False means respect size hints in tiled resizals */
+
++#include "gaplessgrid.c"
+ static Layout layouts[] = {
+ /* symbol arrange function */
+ { "[]=", tile }, /* first entry is default */
+ { "><>", NULL }, /* no layout function means floating behavior */
+ { "[M]", monocle },
++ { "###", gaplessgrid },
+ };
+
+ /* key definitions */
+diff -up dwm-5.2-original/gaplessgrid.c dwm-5.2-modified/gaplessgrid.c
+--- /dev/null 2008-10-20 20:09:51.000000000 +0200
++++ dwm-5.2-modified/gaplessgrid.c 2008-10-20 20:06:59.000000000 +0200
+_AT_@ -0,0 +1,38 @@
++void
++gaplessgrid() {
++ unsigned int n, cols, rows, cn, rn, i, cx, cy, cw, ch;
++ Client *c;
++
++ for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
++ n++;
++ if(n == 0)
++ return;
++
++ /* grid dimensions */
++ for(cols = 0; cols <= n/2; cols++)
++ if(cols*cols >= n)
++ break;
++ if(n == 5) /* set layout against the general calculation: not 1:2:2, but 2:3 */
++ cols = 2;
++ rows = n/cols;
++
++ /* window geometries (cell height/width/x/y) */
++ cw = ww / (cols ? cols : 1);
++ cn = 0; /* current column number */
++ rn = 0; /* current row number */
++ for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) {
++ if(i/rows+1 > cols-n%cols)
++ rows = n/cols+1;
++ ch = wh / (rows ? rows : 1);
++ cx = wx + cn*cw;
++ cy = wy + rn*ch;
++ resize(c, cx, cy, cw - 2 * c->bw, ch - 2 * c->bw, False);
++
++ i++;
++ rn++;
++ if(rn >= rows) { /* jump to the next column */
++ rn = 0;
++ cn++;
++ }
++ }
++}
diff -r 647189e9bab6 -r 8e9929fe55a5 dwm/patches/gaplessgrid.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm/patches/gaplessgrid.md Mon Oct 20 22:33:34 2008 +0200
_AT_@ -0,0 +1,24 @@
+# GAPLESSGRID PATCH #
+
+## Description ##
+
+This patch is similar to [gridmode][1] (in fact it is an altered version) in that it provides a layout for dwm, which arranges the windows in a grid. Though instead of using a regular grid, which in case leaves empty cells (e. g. with 3 windows there are 4 cells, one cell is empty), it uses the same number of columns, but adjusts the number of rows (at first x rows and (x+1) rows, when needed) leaving no empty cells.
+
+## Usage ##
+
+Download the patch and apply it according to the [general instructions](.). The patch will make the following changes:
+1. gaplessgrid.c: adding the file
+2. config.def.h: adding the include-line for 'gaplessgrid.c'
+3. config.def.h: adding the layout '"###", gaplessgrid'
+
+Comment: There may be problems applying the patch, if another layout has been added before.
+
+## Configuration ##
+Add a key definition like '{ MODKEY, XK_g, setlayout, {.v = &layouts[3]} },'.
+
+## Download ##
+ * [dwm-5.2-gaplessgrid.diff][2] (1.9k) (20081020)
+
+[1]: /dwm/patches/gridmode.html
+[2]: http://www.suckless.org/dwm/patches/dwm-5.2-gaplessgrid.diff
+
Received on Mon Oct 20 2008 - 22:38:49 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:30:27 CEST