diff --git a/patches/decklayout/README.md b/patches/decklayout/README.md new file mode 100644 index 0000000..dc9e52d --- /dev/null +++ b/patches/decklayout/README.md @@ -0,0 +1,9 @@ +### Description +Deck is a dwl-layout which is inspired by the dwm Deck layout (which is inspired by TTWM window manager). It applies the monocle-layout to the clients in the stack. The master-client is still visible. The stacked clients are like a deck of cards, hence the name. + +### Download +- [git branch](https://codeberg.org/Kana/dwl/src/branch/decklayout) +- [main 2025-10-08](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/decklayout/decklayout.patch) + +### Authors +- [André Desgualdo Pereira](https://codeberg.org/Kana) diff --git a/patches/decklayout/decklayout.patch b/patches/decklayout/decklayout.patch new file mode 100644 index 0000000..bfd4540 --- /dev/null +++ b/patches/decklayout/decklayout.patch @@ -0,0 +1,112 @@ +From 095439425e64f2567f141d5d941178b148ef0d3a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Desgualdo=20Pereira?= +Date: Sun, 12 Oct 2025 11:44:26 -0300 +Subject: [PATCH] decklayout + +--- + config.def.h | 2 ++ + dwl.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 63 insertions(+) + +diff --git a/config.def.h b/config.def.h +index 95c2afa..cc846eb 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -34,6 +34,7 @@ static const Layout layouts[] = { + { "[]=", tile }, + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "[E]", deck }, + }; + + /* monitors */ +@@ -139,6 +140,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_a, 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 12f441e..227004f 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -278,6 +278,7 @@ static void destroylayersurfacenotify(struct wl_listener *listener, void *data); + static void destroylock(SessionLock *lock, int unlocked); + static void destroylocksurface(struct wl_listener *listener, void *data); + static void destroynotify(struct wl_listener *listener, void *data); ++static void deck(Monitor *m); + static void destroypointerconstraint(struct wl_listener *listener, void *data); + static void destroysessionlock(struct wl_listener *listener, void *data); + static void destroykeyboardgroup(struct wl_listener *listener, void *data); +@@ -1837,6 +1838,66 @@ monocle(Monitor *m) + wlr_scene_node_raise_to_top(&c->scene->node); + } + ++void ++deck(Monitor *m) ++{ ++ unsigned int mw, my; ++ int i, n = 0; ++ Client *c; ++ ++ /* count tiled clients */ ++ wl_list_for_each(c, &clients, link) ++ ++ /* if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) */ ++ if (VISIBLEON(c, m) && !c->isfloating) ++ n++; ++ if (n == 0) ++ return; ++ ++ /* set master width */ ++ if (n > m->nmaster) ++ mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0; ++ else ++ mw = m->w.width; ++ ++ /* update layout symbol with number of stack windows */ ++ /* use the following rules to count only the windows on the deck ++ if (n > m->nmaster) ++ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster); ++ else ++ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); */ ++ ++ /* or this one to count all windows on the tag */ ++ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); ++ ++ i = my = 0; ++ wl_list_for_each(c, &clients, link) { ++ /* if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) */ ++ if (!VISIBLEON(c, m) || c->isfloating) ++ continue; ++ ++ if (i < m->nmaster) { ++ /* master clients */ ++ resize(c, (struct wlr_box){ ++ .x = m->w.x, ++ .y = m->w.y + my, ++ .width = mw, ++ .height = (m->w.height - my) / (MIN(n, m->nmaster) - i) ++ }, 0); ++ my += c->geom.height; ++ } else { ++ /* deck clients: overlap in stack area */ ++ resize(c, (struct wlr_box){ ++ .x = m->w.x + mw, ++ .y = m->w.y, ++ .width = m->w.width - mw, ++ .height = m->w.height ++ }, 0); ++ } ++ i++; ++ } ++} ++ + void + motionabsolute(struct wl_listener *listener, void *data) + { +-- +2.51.0 +