init
This commit is contained in:
Executable
+9
@@ -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)
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
From 7d8cfa63681830a3af4512799b8260f8249bc514 Mon Sep 17 00:00:00 2001
|
||||
From: sewn <sewn@disroot.org>
|
||||
Date: Sun, 8 Sep 2024 22:49:33 +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 | 2 ++
|
||||
dwl.c | 12 ++++++++++++
|
||||
2 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171..f88a615 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 */
|
||||
@@ -140,6 +141,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||
+ { MODKEY, XKB_KEY_n, nextlayout, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user