From 084b90b98efdc659280faf3327a027ad30514493 Mon Sep 17 00:00:00 2001 From: sewn Date: Sun, 8 Sep 2024 22:48:02 +0300 Subject: [PATCH] nextlayout: new patch - 0.7 --- patches/nextlayout/README.md | 9 +++++ patches/nextlayout/nextlayout.patch | 57 +++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 patches/nextlayout/README.md create mode 100644 patches/nextlayout/nextlayout.patch diff --git a/patches/nextlayout/README.md b/patches/nextlayout/README.md new file mode 100644 index 0000000..ea1d4a6 --- /dev/null +++ b/patches/nextlayout/README.md @@ -0,0 +1,9 @@ +### Description +Change the current layout to the next available one. + +### Download +- [0.7](/dwl/dwl-patches/raw/branch/main/patches/nextlayout/nextlayout.patch) + +### Authors +- [sewn](/sewn) + diff --git a/patches/nextlayout/nextlayout.patch b/patches/nextlayout/nextlayout.patch new file mode 100644 index 0000000..2d9d63c --- /dev/null +++ b/patches/nextlayout/nextlayout.patch @@ -0,0 +1,57 @@ +From 2a3a1dbbc83160070296ae7b9f894649dcb284ef Mon Sep 17 00:00:00 2001 +From: sewn +Date: Sun, 8 Sep 2024 22:46:09 +0300 +Subject: [PATCH] add feature to switch to next available layout + +ported from suckless cyclelayouts to be slightly more useful +https://dwm.suckless.org/patches/cyclelayouts/ +--- + config.def.h | 1 + + dwl.c | 12 ++++++++++++ + 2 files changed, 13 insertions(+) + +diff --git a/config.def.h b/config.def.h +index 22d2171..2c8ff86 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 }, ++ { NULL, NULL }, /* terminate */ + }; + + /* monitors */ +diff --git a/dwl.c b/dwl.c +index a2711f6..a66d9d9 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -308,6 +308,7 @@ static void motionnotify(uint32_t time, struct wlr_input_device *device, double + double sy, double sx_unaccel, double sy_unaccel); + static void motionrelative(struct wl_listener *listener, void *data); + static void moveresize(const Arg *arg); ++static void nextlayout(const Arg *arg); + static void outputmgrapply(struct wl_listener *listener, void *data); + static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test); + static void outputmgrtest(struct wl_listener *listener, void *data); +@@ -1927,6 +1928,17 @@ moveresize(const Arg *arg) + } + } + ++void ++nextlayout(const Arg *arg) ++{ ++ Layout *l; ++ for(l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++); ++ if(l->symbol && (l + 1)->symbol) ++ setlayout(&((Arg) { .v = (l + 1) })); ++ else ++ setlayout(&((Arg) { .v = layouts })); ++} ++ + void + outputmgrapply(struct wl_listener *listener, void *data) + { +-- +2.46.0 +