Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-tilewide-6.3.diff - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-tilewide-6.3.diff (2840B)
---
1 From 2916c7a93066da8005e2e30c1e9d90b1e25ac1a1 Mon Sep 17 00:00:00 2001
2 From: sympodius <[email protected]>
3 Date: Sat, 30 Apr 2022 10:57:37 +0100
4 Subject: [PATCH] The 'tilewide' layout is a variant of the standard 'til…
5 layout for dwm. Windows added to the master area will be positioned sid…
6 side, instead of one on top of the other. This makes better use of scre…
7 space on ultra wide monitors. The stack area remains identical to the
8 original 'tile' layout.
9
10 ---
11 config.def.h | 2 ++
12 dwm.c | 29 +++++++++++++++++++++++++++++
13 2 files changed, 31 insertions(+)
14
15 diff --git a/config.def.h b/config.def.h
16 index a2ac963..e7cd62b 100644
17 --- a/config.def.h
18 +++ b/config.def.h
19 @@ -42,6 +42,7 @@ static const Layout layouts[] = {
20 { "[]=", tile }, /* first entry is default */
21 { "><>", NULL }, /* no layout function means floating b…
22 { "[M]", monocle },
23 + { "[][]=", tilewide },
24 };
25
26 /* key definitions */
27 @@ -77,6 +78,7 @@ static Key keys[] = {
28 { MODKEY, XK_t, setlayout, {.v …
29 { MODKEY, XK_f, setlayout, {.v …
30 { MODKEY, XK_m, setlayout, {.v …
31 + { MODKEY, XK_w, setlayout, {.v …
32 { MODKEY, XK_space, setlayout, {0} …
33 { MODKEY|ShiftMask, XK_space, togglefloating, {0} …
34 { MODKEY, XK_0, view, {.ui…
35 diff --git a/dwm.c b/dwm.c
36 index a96f33c..b3ac43b 100644
37 --- a/dwm.c
38 +++ b/dwm.c
39 @@ -234,6 +234,7 @@ static int xerror(Display *dpy, XErrorEvent *ee);
40 static int xerrordummy(Display *dpy, XErrorEvent *ee);
41 static int xerrorstart(Display *dpy, XErrorEvent *ee);
42 static void zoom(const Arg *arg);
43 +static void tilewide(Monitor *m);
44
45 /* variables */
46 static const char broken[] = "broken";
47 @@ -2153,3 +2154,31 @@ main(int argc, char *argv[])
48 XCloseDisplay(dpy);
49 return EXIT_SUCCESS;
50 }
51 +
52 +void
53 +tilewide(Monitor *m)
54 +{
55 + unsigned int i, n, w, h, mw, mx, ty;
56 + Client *c;
57 +
58 + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next…
59 + if (n == 0)
60 + return;
61 + if (n > m->nmaster)
62 + mw = m->nmaster ? m->ww * m->mfact : 0;
63 + else
64 + mw = m->ww;
65 + for (i = mx = ty = 0, c = nexttiled(m->clients); c;
66 + c = nexttiled(c->next), i++)
67 + if (i < m->nmaster) {
68 + w = (mw - mx) / (MIN(n, m->nmaster) - i);
69 + resize(c, m->wx + mx, m->wy, w - (2*c->bw), (m-…
70 + if (mx + WIDTH(c) < m->ww)
71 + mx += WIDTH(c);
72 + } else {
73 + h = (m->wh - ty) / (n - i);
74 + resize(c, m->wx + mw, m->wy + ty, m->ww - mw - …
75 + if (ty + HEIGHT(c) < m->wh)
76 + ty += HEIGHT(c);
77 + }
78 +}
79 --
80 2.35.1
81
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.