Skip to content

Commit ff80ae2

Browse files
committed
allow tags to lock down their layout
1 parent 6d402e5 commit ff80ae2

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

dwm-locklayout-6.2.diff

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

0 commit comments

Comments
 (0)