From 348dc2ed3365dccb00175b9f9c495b063b6c9c19 Mon Sep 17 00:00:00 2001 From: MayOrMayNotBeACat Date: Fri, 11 Jul 2025 22:01:55 -0400 Subject: [PATCH] Add stairs patch --- patches/stairs/README.md | 42 +++++++++++ patches/stairs/stairs.patch | 136 ++++++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 patches/stairs/README.md create mode 100644 patches/stairs/stairs.patch diff --git a/patches/stairs/README.md b/patches/stairs/README.md new file mode 100644 index 0000000..403a276 --- /dev/null +++ b/patches/stairs/README.md @@ -0,0 +1,42 @@ +### Description +Port of the [stairs](https://dwm.suckless.org/patches/stairs/) patch from dwm. + +The remaining text is from the description on the dwm site: + +This layout can be modified using the 3 variables provided in config.h: stairpx, stairdirection and stairsamesize. + +``` ++-------------+--------+----------------+ +| | | | +| | +--| S1 | +| | |S2| | +| | +--| | | +| | |S3| | | +| M |--| | +----------------+ +| |S4| | | | +| | | +-----------------+ | +| | | | | +| | +------------------+ | +| | | | ++-------------+-------------------+-----+ + stairsamesize = 1 + ++-------------+--------+----------------+ +| | | | +| | +--| S1 | +| | |S2| | +| | +--| | | +| | |S3| | | +| M |--| | | | +| |S4| | | | +| | | | | | +| | | | | | +| | | | | | +| | | | | | ++-------------+--+--+--+----------------+ + stairsamesize = 0 +``` +### Download +- [0.7](/dwl/dwl-patches/raw/branch/main/patches/stairs/stairs.patch) +### Authors +- [MayOrMayNotBeACat](https://codeberg.org/MayOrMayNotBeACat) diff --git a/patches/stairs/stairs.patch b/patches/stairs/stairs.patch new file mode 100644 index 0000000..d39932e --- /dev/null +++ b/patches/stairs/stairs.patch @@ -0,0 +1,136 @@ +From d5bbe6d54d044fa11c76e2e20b96a44897319424 Mon Sep 17 00:00:00 2001 +From: Nikita Ivanov +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 +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 +