diff options
author | Leonard Kugis <leonard@kug.is> | 2025-05-23 11:41:09 +0000 |
---|---|---|
committer | Leonard Kugis <leonard@kug.is> | 2025-05-23 11:41:09 +0000 |
commit | c70505d7c7b7b48600f273357694b56ccf5d2a15 (patch) | |
tree | 21c27ac6ffced8d6d904e35bdb39baa5d685d829 /dwl-patches/patches/column | |
download | dotfiles-c70505d7c7b7b48600f273357694b56ccf5d2a15.tar.gz dotfiles-c70505d7c7b7b48600f273357694b56ccf5d2a15.tar.bz2 dotfiles-c70505d7c7b7b48600f273357694b56ccf5d2a15.zip |
Diffstat (limited to 'dwl-patches/patches/column')
-rw-r--r-- | dwl-patches/patches/column/README.md | 9 | ||||
-rw-r--r-- | dwl-patches/patches/column/column.patch | 79 |
2 files changed, 88 insertions, 0 deletions
diff --git a/dwl-patches/patches/column/README.md b/dwl-patches/patches/column/README.md new file mode 100644 index 0000000..9d1b205 --- /dev/null +++ b/dwl-patches/patches/column/README.md @@ -0,0 +1,9 @@ +### Description
+A column layout patch. This patch just puts the visible clients into equal-width columns on the screen.
+
+### Download
+- [git branch](https://codeberg.org/bencc/dwl/src/branch/column)
+- [2024-01-02](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/column/column.patch)
+
+### Authors
+- [Ben Collerson](https://codeberg.org/bencc)
\ No newline at end of file diff --git a/dwl-patches/patches/column/column.patch b/dwl-patches/patches/column/column.patch new file mode 100644 index 0000000..0f6a531 --- /dev/null +++ b/dwl-patches/patches/column/column.patch @@ -0,0 +1,79 @@ +From d1eb2061c619d0bbd7a0ecda0fe77409f3a6c399 Mon Sep 17 00:00:00 2001 +From: Ben Collerson <benc@benc.cc> +Date: Fri, 29 Dec 2023 19:02:11 +1000 +Subject: [PATCH] column layout + +--- + config.def.h | 2 ++ + dwl.c | 28 ++++++++++++++++++++++++++++ + 2 files changed, 30 insertions(+) + +diff --git a/config.def.h b/config.def.h +index a8ed61d9..edb30cae 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 }, ++ { "||", col }, + }; + + /* 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_c, 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 4d19357f..63d80da7 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -243,6 +243,7 @@ static void checkidleinhibitor(struct wlr_surface *exclude); + static void cleanup(void); + static void cleanupmon(struct wl_listener *listener, void *data); + static void closemon(Monitor *m); ++static void col(Monitor *m); + static void commitlayersurfacenotify(struct wl_listener *listener, void *data); + static void commitnotify(struct wl_listener *listener, void *data); + static void createdecoration(struct wl_listener *listener, void *data); +@@ -704,6 +705,33 @@ closemon(Monitor *m) + printstatus(); + } + ++void ++col(Monitor *m) ++{ ++ Client *c; ++ unsigned int n = 0, i = 0; ++ ++ wl_list_for_each(c, &clients, link) ++ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) ++ n++; ++ ++ wl_list_for_each(c, &clients, link) { ++ if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) ++ continue; ++ resize( ++ c, ++ (struct wlr_box){ ++ .x = m->w.x + i * m->w.width / n, ++ .y = m->w.y, ++ .width = m->w.width / n, ++ .height = m->w.height ++ }, ++ 0 ++ ); ++ i++; ++ } ++} ++ + void + commitlayersurfacenotify(struct wl_listener *listener, void *data) + { +-- +2.43.0 + |