dwm-deck-6.0.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-deck-6.0.diff (3099B) | |
--- | |
1 From cb3cac91db32403bb581aecbc2957b00bb49c898 Mon Sep 17 00:00:00 2001 | |
2 From: aleks <[email protected]> | |
3 Date: Mon, 6 May 2019 16:34:58 +0200 | |
4 Subject: [PATCH] Add deck-layout | |
5 | |
6 deck is a dwm-layout which is inspired by the TTWM window manager. | |
7 It applies the monocle-layout to the clients in the stack. | |
8 The master-client is still visible. The stacked clients are like | |
9 a deck of cards, hence the name. | |
10 | |
11 The vanilla patch doesn't work properly with patches which add gaps. | |
12 This means that when the deck-layout is activated gaps are omitted. | |
13 To make it work with the tilegap-patch apply the dwm-deck-tilegap patch | |
14 on top of the dwm-deck patch. | |
15 | |
16 The vanilla patch doesn't respect the master-area which is defined by | |
17 the rmaster-patch. To make it work with the rmaster-patch apply the | |
18 dwm-deck-rmaster patch on top of the dwm-deck patch. | |
19 --- | |
20 config.def.h | 2 ++ | |
21 dwm.c | 26 ++++++++++++++++++++++++++ | |
22 2 files changed, 28 insertions(+) | |
23 | |
24 diff --git a/config.def.h b/config.def.h | |
25 index 77ff358..55d8a07 100644 | |
26 --- a/config.def.h | |
27 +++ b/config.def.h | |
28 @@ -32,6 +32,7 @@ static const Layout layouts[] = { | |
29 { "[]=", tile }, /* first entry is default */ | |
30 { "><>", NULL }, /* no layout function means floating b… | |
31 { "[M]", monocle }, | |
32 + { "[D]", deck }, | |
33 }; | |
34 | |
35 /* key definitions */ | |
36 @@ -66,6 +67,7 @@ static Key keys[] = { | |
37 { MODKEY, XK_t, setlayout, {.v … | |
38 { MODKEY, XK_f, setlayout, {.v … | |
39 { MODKEY, XK_m, setlayout, {.v … | |
40 + { MODKEY, XK_c, setlayout, {.v … | |
41 { MODKEY, XK_space, setlayout, {0} … | |
42 { MODKEY|ShiftMask, XK_space, togglefloating, {0} … | |
43 { MODKEY, XK_0, view, {.ui… | |
44 diff --git a/dwm.c b/dwm.c | |
45 index 1d78655..356ab44 100644 | |
46 --- a/dwm.c | |
47 +++ b/dwm.c | |
48 @@ -171,6 +171,7 @@ static void configure(Client *c); | |
49 static void configurenotify(XEvent *e); | |
50 static void configurerequest(XEvent *e); | |
51 static Monitor *createmon(void); | |
52 +static void deck(Monitor *m); | |
53 static void destroynotify(XEvent *e); | |
54 static void detach(Client *c); | |
55 static void detachstack(Client *c); | |
56 @@ -669,6 +670,31 @@ destroynotify(XEvent *e) { | |
57 unmanage(c, True); | |
58 } | |
59 | |
60 +void | |
61 +deck(Monitor *m) { | |
62 + unsigned int i, n, h, mw, my; | |
63 + Client *c; | |
64 + | |
65 + for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)… | |
66 + if(n == 0) | |
67 + return; | |
68 + | |
69 + if(n > m->nmaster) { | |
70 + mw = m->nmaster ? m->ww * m->mfact : 0; | |
71 + snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m… | |
72 + } | |
73 + else | |
74 + mw = m->ww; | |
75 + for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->… | |
76 + if(i < m->nmaster) { | |
77 + h = (m->wh - my) / (MIN(n, m->nmaster) - i); | |
78 + resize(c, m->wx, m->wy + my, mw - (2*c->bw), h … | |
79 + my += HEIGHT(c); | |
80 + } | |
81 + else | |
82 + resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c-… | |
83 +} | |
84 + | |
85 void | |
86 detach(Client *c) { | |
87 Client **tc; | |
88 -- | |
89 2.21.0 | |
90 |