-
Notifications
You must be signed in to change notification settings - Fork 0
/
dwm-locklayout-6.2.diff
78 lines (70 loc) · 2.03 KB
/
dwm-locklayout-6.2.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From 57ab331f1ef2d9724d48d75b1443d889323dbc3d Mon Sep 17 00:00:00 2001
From: Hilde N <[email protected]>
Date: Sat, 23 May 2020 21:34:12 -0400
Subject: [PATCH] allow tags to lock down their layout
---
config.def.h | 8 ++++----
dwm.c | 14 +++++++++++++-
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..160f484 100644
--- a/config.def.h
+++ b/config.def.h
@@ -37,10 +37,10 @@ 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 Layout layouts[] = {
- /* symbol arrange function */
- { "[]=", tile }, /* first entry is default */
- { "><>", NULL }, /* no layout function means floating behavior */
- { "[M]", monocle },
+ /* symbol arrange function tag mask*/
+ { "[]=", tile, 0 }, /* first entry is default */
+ { "><>", NULL, 0 }, /* no layout function means floating behavior */
+ { "[M]", monocle, 0 },
};
/* key definitions */
diff --git a/dwm.c b/dwm.c
index 9fd0286..1783da0 100644
--- a/dwm.c
+++ b/dwm.c
@@ -109,6 +109,7 @@ typedef struct {
typedef struct {
const char *symbol;
void (*arrange)(Monitor *);
+ unsigned int tags;
} Layout;
struct Monitor {
@@ -471,7 +472,7 @@ void
cleanup(void)
{
Arg a = {.ui = ~0};
- Layout foo = { "", NULL };
+ Layout foo = { "", NULL, 0 };
Monitor *m;
size_t i;
@@ -2038,6 +2039,9 @@ updatewmhints(Client *c)
void
view(const Arg *arg)
{
+ int i;
+ Arg tmparg;
+
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
return;
selmon->seltags ^= 1; /* toggle sel tagset */
@@ -2045,6 +2049,14 @@ view(const Arg *arg)
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
focus(NULL);
arrange(selmon);
+
+ for (i = 0; i < LENGTH(layouts); i++) {
+ if (selmon->tagset[selmon->seltags] & layouts[i].tags) {
+ tmparg.v = &layouts[i];
+ setlayout(&tmparg);
+ break;
+ }
+ }
}
Client *
--
2.26.2