dwm-horizgrid-6.1.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-horizgrid-6.1.diff (2228B) | |
--- | |
1 From 064e1d48631cd9b03f32b42d7be79677197ee42f Mon Sep 17 00:00:00 2001 | |
2 From: Marshall Mason <[email protected]> | |
3 Date: Mon, 9 Nov 2015 12:38:28 -0800 | |
4 Subject: [PATCH] Added horizgrid function | |
5 | |
6 --- | |
7 config.def.h | 2 ++ | |
8 horizgrid.c | 32 ++++++++++++++++++++++++++++++++ | |
9 2 files changed, 34 insertions(+) | |
10 create mode 100644 horizgrid.c | |
11 | |
12 diff --git a/config.def.h b/config.def.h | |
13 index eaae8f3..c2ad519 100644 | |
14 --- a/config.def.h | |
15 +++ b/config.def.h | |
16 @@ -36,11 +36,13 @@ static const float mfact = 0.55; /* factor of m… | |
17 static const int nmaster = 1; /* number of clients in master ar… | |
18 static const Bool resizehints = True; /* True means respect size hints … | |
19 | |
20 +#include "horizgrid.c" | |
21 static const Layout layouts[] = { | |
22 /* symbol arrange function */ | |
23 { "[]=", tile }, /* first entry is default */ | |
24 { "><>", NULL }, /* no layout function means floating b… | |
25 { "[M]", monocle }, | |
26 + { "###", horizgrid }, | |
27 }; | |
28 | |
29 /* key definitions */ | |
30 diff --git a/horizgrid.c b/horizgrid.c | |
31 new file mode 100644 | |
32 index 0000000..51ce0f8 | |
33 --- /dev/null | |
34 +++ b/horizgrid.c | |
35 @@ -0,0 +1,32 @@ | |
36 +void | |
37 +horizgrid(Monitor *m) { | |
38 + Client *c; | |
39 + unsigned int n, i; | |
40 + int w = 0; | |
41 + int ntop, nbottom = 0; | |
42 + | |
43 + /* Count windows */ | |
44 + for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)… | |
45 + | |
46 + if(n == 0) | |
47 + return; | |
48 + else if(n == 1) { /* Just fill the whole screen */ | |
49 + c = nexttiled(m->clients); | |
50 + resize(c, m->wx, m->wy, m->ww - (2*c->bw), m->wh - (2*c… | |
51 + } else if(n == 2) { /* Split vertically */ | |
52 + w = m->ww / 2; | |
53 + c = nexttiled(m->clients); | |
54 + resize(c, m->wx, m->wy, w - (2*c->bw), m->wh - (2*c->bw… | |
55 + c = nexttiled(c->next); | |
56 + resize(c, m->wx + w, m->wy, w - (2*c->bw), m->wh - (2*c… | |
57 + } else { | |
58 + ntop = n / 2; | |
59 + nbottom = n - ntop; | |
60 + for(i = 0, c = nexttiled(m->clients); c; c = nexttiled(… | |
61 + if(i < ntop) | |
62 + resize(c, m->wx + i * m->ww / ntop, m->… | |
63 + else | |
64 + resize(c, m->wx + (i - ntop) * m->ww / … | |
65 + } | |
66 + } | |
67 +} | |
68 -- | |
69 2.1.4 | |
70 |