mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-07 11:44:51 +00:00
nextlayout: new patch - 0.7
This commit is contained in:
parent
b1a2620e28
commit
084b90b98e
9
patches/nextlayout/README.md
Normal file
9
patches/nextlayout/README.md
Normal file
@ -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)
|
||||
|
57
patches/nextlayout/nextlayout.patch
Normal file
57
patches/nextlayout/nextlayout.patch
Normal file
@ -0,0 +1,57 @@
|
||||
From 2a3a1dbbc83160070296ae7b9f894649dcb284ef Mon Sep 17 00:00:00 2001
|
||||
From: sewn <sewn@disroot.org>
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user