[wiki] [sites] Tatami Layout Patch for dwm: Adds a tatami layout to dwm, accessible through Alt+Y More details are given in the index.md || Sarthak Shah

From: <git_AT_suckless.org>
Date: Fri, 25 Sep 2020 07:43:05 +0200

commit c8bb38cc7df701180260f7ea3b66f903349477c4
Author: Sarthak Shah <shahsarthakw_AT_gmail.com>
Date: Fri Sep 25 11:10:26 2020 +0000

    Tatami Layout Patch for dwm:
    Adds a tatami layout to dwm, accessible through Alt+Y
    More details are given in the index.md
    
    Changes to be committed:
          new file: dwm.suckless.org/patches/tatami/dwm-tatami-6.2.diff
          new file: dwm.suckless.org/patches/tatami/index.md

diff --git a/dwm.suckless.org/patches/tatami/dwm-tatami-6.2.diff b/dwm.suckless.org/patches/tatami/dwm-tatami-6.2.diff
new file mode 100755
index 00000000..13a9c555
--- /dev/null
+++ b/dwm.suckless.org/patches/tatami/dwm-tatami-6.2.diff
_AT_@ -0,0 +1,189 @@
+diff -Naur dwm/config.def.h dwm-tatami/config.def.h
+--- dwm/config.def.h 2020-09-24 02:14:27.545355268 -0500
++++ dwm-tatami/config.def.h 2020-09-24 02:46:12.041952267 -0500
+_AT_@ -34,13 +34,15 @@
+ /* layout(s) */
+ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
+ static const int nmaster = 1; /* number of clients in master area */
+-static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
++static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
+
++#include "tatami.c"
+ static const Layout layouts[] = {
+ /* symbol arrange function */
+ { "[]=", tile }, /* first entry is default */
+ { "><>", NULL }, /* no layout function means floating behavior */
+ { "[M]", monocle },
++ { "|+|", tatami },
+ };
+
+ /* key definitions */
+_AT_@ -76,6 +78,7 @@
+ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
+ { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
+ { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
++ { MODKEY, XK_y, setlayout, {.v = &layouts[3]} },
+ { MODKEY, XK_space, setlayout, {0} },
+ { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
+ { MODKEY, XK_0, view, {.ui = ~0 } },
+diff -Naur dwm/tatami.c dwm-tatami/tatami.c
+--- dwm/tatami.c 1969-12-31 18:00:00.000000000 -0600
++++ dwm-tatami/tatami.c 2020-09-24 02:17:14.335349175 -0500
+_AT_@ -0,0 +1,157 @@
++void
++tatami(Monitor *m) {
++ unsigned int i, n, nx, ny, nw, nh,
++ mats, tc,
++ tnx, tny, tnw, tnh;
++ Client *c;
++
++ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), ++n);
++ if(n == 0)
++ return;
++
++ nx = m->wx;
++ ny = 0;
++ nw = m->ww;
++ nh = m->wh;
++
++ c = nexttiled(m->clients);
++
++ if(n != 1) nw = m->ww * m->mfact;
++ ny = m->wy;
++
++ resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False);
++
++ c = nexttiled(c->next);
++
++ nx += nw;
++ nw = m->ww - nw;
++
++ if(n>1)
++ {
++
++ tc = n-1;
++ mats = tc/5;
++
++ nh/=(mats + (tc % 5 > 0));
++
++ for(i = 0; c && (i < (tc % 5)); c = nexttiled(c->next))
++ {
++ tnw=nw;
++ tnx=nx;
++ tnh=nh;
++ tny=ny;
++ switch(tc - (mats*5))
++ {
++ case 1://fill
++ break;
++ case 2://up and down
++ if((i % 5) == 0) //up
++ tnh/=2;
++ else if((i % 5) == 1) //down
++ {
++ tnh/=2;
++ tny += nh/2;
++ }
++ break;
++ case 3://bottom, up-left and up-right
++ if((i % 5) == 0) //up-left
++ {
++ tnw = nw/2;
++ tnh = (2*nh)/3;
++ }
++ else if((i % 5) == 1)//up-right
++ {
++ tnx += nw/2;
++ tnw = nw/2;
++ tnh = (2*nh)/3;
++ }
++ else if((i % 5) == 2)//bottom
++ {
++ tnh = nh/3;
++ tny += (2*nh)/3;
++ }
++ break;
++ case 4://bottom, left, right and top
++ if((i % 5) == 0) //top
++ {
++ tnh = (nh)/4;
++ }
++ else if((i % 5) == 1)//left
++ {
++ tnw = nw/2;
++ tny += nh/4;
++ tnh = (nh)/2;
++ }
++ else if((i % 5) == 2)//right
++ {
++ tnx += nw/2;
++ tnw = nw/2;
++ tny += nh/4;
++ tnh = (nh)/2;
++ }
++ else if((i % 5) == 3)//bottom
++ {
++ tny += (3*nh)/4;
++ tnh = (nh)/4;
++ }
++ break;
++ }
++ ++i;
++ resize(c, tnx, tny, tnw - 2 * c->bw, tnh - 2 * c->bw, False);
++ }
++
++ ++mats;
++
++ for(i = 0; c && (mats>0); c = nexttiled(c->next)) {
++
++ if((i%5)==0)
++ {
++ --mats;
++ if(((tc % 5) > 0)||(i>=5))
++ ny+=nh;
++ }
++
++ tnw=nw;
++ tnx=nx;
++ tnh=nh;
++ tny=ny;
++
++
++ switch(i % 5)
++ {
++ case 0: //top-left-vert
++ tnw = (nw)/3;
++ tnh = (nh*2)/3;
++ break;
++ case 1: //top-right-hor
++ tnx += (nw)/3;
++ tnw = (nw*2)/3;
++ tnh = (nh)/3;
++ break;
++ case 2: //center
++ tnx += (nw)/3;
++ tnw = (nw)/3;
++ tny += (nh)/3;
++ tnh = (nh)/3;
++ break;
++ case 3: //bottom-right-vert
++ tnx += (nw*2)/3;
++ tnw = (nw)/3;
++ tny += (nh)/3;
++ tnh = (nh*2)/3;
++ break;
++ case 4: //(oldest) bottom-left-hor
++ tnw = (2*nw)/3;
++ tny += (2*nh)/3;
++ tnh = (nh)/3;
++ break;
++ default:
++ break;
++ }
++
++ ++i;
++ //i%=5;
++ resize(c, tnx, tny, tnw - 2 * c->bw, tnh - 2 * c->bw, False);
++ }
++ }
++}
diff --git a/dwm.suckless.org/patches/tatami/index.md b/dwm.suckless.org/patches/tatami/index.md
new file mode 100644
index 00000000..db90a86e
--- /dev/null
+++ b/dwm.suckless.org/patches/tatami/index.md
_AT_@ -0,0 +1,67 @@
+tatami layout
+=============
+
+Description
+-----------
+This patch adds a new layout, tatami, that arranges all windows like
+tatami tiles. This patch forms 'mats' of 5 or less windows each, and
+each mat has 5 different possible arrangements. The mats then form a
+stack as shown in the `7+ windows` diagram below.
+
+ +-----------+-----------+ +-----------+-----------+
+ | | | | | |
+ | | | | | 2 |
+ | | | | | |
+ | 1 | 2 | | 1 +-----------+
+ | | | | | |
+ | | | | | 3 |
+ | | | | | |
+ +-----------+-----------+ +-----------+-----------+
+ 2 windows 3 windows
+
+ +-----------+-----+-----+ +-----------+-----------+
+ | | | | | | 2 |
+ | | 2 | 3 | | +-----+-----+
+ | | | | | | | |
+ | 1 +-----+-----+ | 1 | 3 | 4 |
+ | | | | | | |
+ | | 4 | | +-----+-----+
+ | | | | | 5 |
+ +-----------+-----------+ +-----------+-----+-----+
+ 4 windows 5 windows
+
+ +-----------+---+-------+ +-----------+-----------+
+ | | | 3 | | | new |
+ | | 2 +---+---+ | +---+-------+
+ | | | | | | | | 4 |
+ | 1 | | 4 | | | 1 | 3 +---+---+
+ | | | | 5 | | | | 5 | |
+ | +---+---+ | | +---+---+ 6 |
+ | | 6 | | | | 7 | |
+ +-----------+-------+---+ +-----------+-------+---+
+ 6 windows 7+ windows
+
+
+Usage
+-----
+1. Download the patch and apply according to the [general instructions](.).
+2. Include the `tatami.c` source file and add `tatami` to the `Layout`
+ section of your `config.h` file. Example from `config.default.h`:
+
+ #include "tatami.c"
+ static Layout layout[] = {
+ /* symbol function */
+ { "[]=", tile }, /* first entry is default */
+ { "><>", floating },
+ { "|+|", tatami },
+ };
+
+3. The default keybinding is [Alt]+[y] for tatami.
+
+Download
+--------
+* [dwm-tatami-6.2.diff](dwm-tatami-6.2.diff)
+
+Maintainer
+----------
+* Sarthak Shah - <shahsarthakw_AT_gmail.com>
Received on Fri Sep 25 2020 - 07:43:05 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 25 2020 - 07:48:43 CEST