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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
From d5bbe6d54d044fa11c76e2e20b96a44897319424 Mon Sep 17 00:00:00 2001
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
Date: Tue, 4 Feb 2025 20:51:06 +0100
Subject: [PATCH 1/2] Fix crash disabling monitor with locked surface
(cherry picked from commit d1880b44223701c91b51b319fc69a0f63044f861)
---
dwl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dwl.c b/dwl.c
index cf3ef70..c717c1d 100644
--- a/dwl.c
+++ b/dwl.c
@@ -716,6 +716,8 @@ cleanupmon(struct wl_listener *listener, void *data)
wl_list_remove(&m->frame.link);
wl_list_remove(&m->link);
wl_list_remove(&m->request_state.link);
+ if (m->lock_surface)
+ destroylocksurface(&m->destroy_lock_surface, NULL);
m->wlr_output->data = NULL;
wlr_output_layout_remove(output_layout, m->wlr_output);
wlr_scene_output_destroy(m->scene_output);
--
2.50.1
From b6e96ab6281eddacdda26c39e6446b72ce05de39 Mon Sep 17 00:00:00 2001
From: JustinWayland <justintwayland+github@gmail.com>
Date: Fri, 6 Jun 2025 22:14:31 -0400
Subject: [PATCH 2/2] Add stairs layout.
---
config.def.h | 5 +++++
dwl.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/config.def.h b/config.def.h
index 22d2171..e81568c 100644
--- a/config.def.h
+++ b/config.def.h
@@ -7,6 +7,9 @@
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 1; /* border pixel of windows */
+static const unsigned int stairpx = 20; /* depth of the stairs layout */
+static const int stairdirection = 1; /* 0: left-aligned, 1: right-aligned */
+static const int stairsamesize = 1; /* 1 means shrink all the staired windows to the same size */
static const float rootcolor[] = COLOR(0x222222ff);
static const float bordercolor[] = COLOR(0x444444ff);
static const float focuscolor[] = COLOR(0x005577ff);
@@ -34,6 +37,7 @@ static const Layout layouts[] = {
{ "[]=", tile },
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "[S]", stairs },
};
/* monitors */
@@ -139,6 +143,7 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XKB_KEY_s, setlayout, {.v = &layouts[3]} },
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
diff --git a/dwl.c b/dwl.c
index cf3ef70..4debf15 100644
--- a/dwl.c
+++ b/dwl.c
@@ -334,6 +334,7 @@ static void setpsel(struct wl_listener *listener, void *data);
static void setsel(struct wl_listener *listener, void *data);
static void setup(void);
static void spawn(const Arg *arg);
+static void stairs(Monitor* m);
static void startdrag(struct wl_listener *listener, void *data);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
@@ -2657,6 +2658,53 @@ spawn(const Arg *arg)
}
}
+void
+stairs(Monitor *m)
+{
+ int i, n, h, mw, my;
+ int ox, oy, ow, oh;
+ Client *c;
+
+ n = 0;
+ wl_list_for_each(c, &clients, link)
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
+ n++;
+ if (n == 0)
+ return;
+
+ if (n > m->nmaster)
+ mw = m->nmaster ? ROUND(m->w.width * m->mfact) : 0;
+ else
+ mw = m->w.width;
+
+ i = my = 0;
+ wl_list_for_each(c, &clients, link) {
+ if (!VISIBLEON(c,m) || c->isfloating || c->fullscreen)
+ continue;
+ if (i < m->nmaster) {
+ h = (m->w.height - my) / (MIN(n, m->nmaster) - i);
+ resize(c, (struct wlr_box){
+ .x=m->w.x,.y=m->w.y + my,.width=mw,.height=h
+ }, 0);
+ my += c->geom.height;
+ } else {
+ oy = i - m->nmaster;
+ ox = stairdirection ? n - i - 1 : (stairsamesize ? i - m->nmaster: 0);
+ ow = stairsamesize ? n - m->nmaster - 1 : n - i - 1;
+ oh = stairsamesize ? ow : i - m->nmaster;
+ resize(c, (struct wlr_box){
+ .x=m->w.x + mw + (ox * stairpx),
+ .y=m->w.y + (oy * stairpx),
+ .width=m->w.width - mw - (ow * stairpx),
+ .height=m->w.height - (oh * stairpx)
+ }, 0);
+ if (c == focustop(selmon))
+ wlr_scene_node_raise_to_top(&c->scene->node);
+ }
+ i++;
+ }
+}
+
void
startdrag(struct wl_listener *listener, void *data)
{
--
2.50.1
|