aboutsummaryrefslogtreecommitdiff
path: root/patches/dwm-gaplessgrid-20160731-56a31dc.diff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-04-18 14:11:55 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-04-18 14:11:55 +0100
commitaabccefea1d4c8b5ffe6ad0dcdaac1612d502d92 (patch)
tree78870beb4f49860bfcc490ad9e99f07bf403fb9a /patches/dwm-gaplessgrid-20160731-56a31dc.diff
parentd1e0e1e8c69735a295c03654bf29f76071a9378e (diff)
downloaddwm-aabccefea1d4c8b5ffe6ad0dcdaac1612d502d92.tar.gz
dwm-aabccefea1d4c8b5ffe6ad0dcdaac1612d502d92.tar.bz2
dwm-aabccefea1d4c8b5ffe6ad0dcdaac1612d502d92.zip
Added patches folder
Diffstat (limited to 'patches/dwm-gaplessgrid-20160731-56a31dc.diff')
-rw-r--r--patches/dwm-gaplessgrid-20160731-56a31dc.diff43
1 files changed, 43 insertions, 0 deletions
diff --git a/patches/dwm-gaplessgrid-20160731-56a31dc.diff b/patches/dwm-gaplessgrid-20160731-56a31dc.diff
new file mode 100644
index 0000000..4f3bb13
--- /dev/null
+++ b/patches/dwm-gaplessgrid-20160731-56a31dc.diff
@@ -0,0 +1,43 @@
+URL: http://dwm.suckless.org/patches/gapless_grid
+Add gapless grid layout.
+
+Index: dwm/gaplessgrid.c
+===================================================================
+--- /dev/null
++++ dwm/gaplessgrid.c
+@@ -0,0 +1,35 @@
++void
++gaplessgrid(Monitor *m) {
++ unsigned int n, cols, rows, cn, rn, i, cx, cy, cw, ch;
++ Client *c;
++
++ for(n = 0, c = nexttiled(m->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 */
++ cw = cols ? m->ww / cols : m->ww;
++ cn = 0; /* current column number */
++ rn = 0; /* current row number */
++ for(i = 0, c = nexttiled(m->clients); c; i++, c = nexttiled(c->next)) {
++ if(i/rows + 1 > cols - n%cols)
++ rows = n/cols + 1;
++ ch = rows ? m->wh / rows : m->wh;
++ cx = m->wx + cn*cw;
++ cy = m->wy + rn*ch;
++ resize(c, cx, cy, cw - 2 * c->bw, ch - 2 * c->bw, False);
++ rn++;
++ if(rn >= rows) {
++ rn = 0;
++ cn++;
++ }
++ }
++}