From 7da34dd6a781a5d5b1f9efeaffc4e52a718ff34b Mon Sep 17 00:00:00 2001 From: anabasis Date: Fri, 10 May 2024 22:53:23 -0400 Subject: [PATCH] revive deck patch --- .../deck.md => patches/deck/README.md | 15 ++-- patches/deck/deck.patch | 87 +++++++++++++++++++ 2 files changed, 94 insertions(+), 8 deletions(-) rename _STALE_PATCHES/deck.md => patches/deck/README.md (56%) create mode 100644 patches/deck/deck.patch diff --git a/_STALE_PATCHES/deck.md b/patches/deck/README.md similarity index 56% rename from _STALE_PATCHES/deck.md rename to patches/deck/README.md index ed0878d..419f7a4 100644 --- a/_STALE_PATCHES/deck.md +++ b/patches/deck/README.md @@ -1,11 +1,8 @@ ### Description -[deck](https://dwm.suckless.org/patches/deck/) is a port of the dwm-layout with the same name. 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. +Adds a layout with a monocle layout for clients in the stack (port of the [deck layout for dwm](https://dwm.suckless.org/patches/deck/)); stacked clients are like a deck of cards (see below) -### Scheme ``` -Showcase - -Tile : +Tile: +-----------------+--------+ | | | | | S1 | @@ -16,7 +13,7 @@ Tile : | | | +-----------------+--------+ -Deck : +Deck: +-----------------+--------+ | | | | | | @@ -29,7 +26,9 @@ Deck : ``` ### Download -- [2023-07-09](https://github.com/djpohly/dwl/compare/main...PalanixYT:deck.patch) +- [git branch](https://codeberg.org/anabasis/dwl/src/branch/deck) +- [2024-05-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/deck/deck.patch) ### Authors -- [Palanix](https://github.com/PalanixYT) \ No newline at end of file +- [anabasis](https://codeberg.org/anabasis) +- [Palanix](https://codeberg.org/Palanix) diff --git a/patches/deck/deck.patch b/patches/deck/deck.patch new file mode 100644 index 0000000..e9cb720 --- /dev/null +++ b/patches/deck/deck.patch @@ -0,0 +1,87 @@ +From d56f732d3b5bba4ea0bdf56a91d0992b0cb25bfb Mon Sep 17 00:00:00 2001 +From: anabasis +Date: Fri, 10 May 2024 13:45:33 -0400 +Subject: [PATCH] add deck layout + +--- + config.def.h | 2 ++ + dwl.c | 36 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 38 insertions(+) + +diff --git a/config.def.h b/config.def.h +index 8f498d2..9238da0 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -33,6 +33,7 @@ static const Layout layouts[] = { + { "[]=", tile }, + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "[D]", deck }, + }; + + /* monitors */ +@@ -134,6 +135,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_r, 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 bf763df..1a7ce8e 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -267,6 +267,7 @@ static void createpointerconstraint(struct wl_listener *listener, void *data); + static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint); + static void cursorframe(struct wl_listener *listener, void *data); + static void cursorwarptohint(void); ++static void deck(Monitor *m); + static void destroydecoration(struct wl_listener *listener, void *data); + static void destroydragicon(struct wl_listener *listener, void *data); + static void destroyidleinhibitor(struct wl_listener *listener, void *data); +@@ -1080,6 +1081,41 @@ cursorwarptohint(void) + } + } + ++void ++deck(Monitor *m) ++{ ++ unsigned int mw, my; ++ int i, n = 0; ++ Client *c; ++ ++ 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->isfullscreen) ++ continue; ++ if (i < m->nmaster) { ++ 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 { ++ resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y, ++ .width = m->w.width - mw, .height = m->w.height}, 0); ++ if (c == focustop(m)) ++ wlr_scene_node_raise_to_top(&c->scene->node); ++ } ++ i++; ++ } ++} ++ + void + destroydecoration(struct wl_listener *listener, void *data) + { +-- +2.45.0 +