commit 45438f51a3021272da3c0479a1402cdb33557661
parent c09630b11415b68f6fdb9a084e9b706c6623b12b
Author: Erik Letson <hmagellan@hmagellan.com>
Date: Sun, 9 Aug 2020 10:47:03 -0500
Added cyclelayouts
Diffstat:
2 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/cyclelayouts/USAGE b/cyclelayouts/USAGE
@@ -0,0 +1,18 @@
+cyclelayouts - Cycles through all available layouts
+https://dwm.suckless.org/patches/cyclelayouts/
+Original Autor: cd
+
+== YOU MUST ==
+(1). Place the patch file in /etc/portage/patches/x11-wm/dwm/ and run 'emerge dwm'
+(2). Add an entry at the end of your layout list in your savedconfig file that looks like this:
+
+ { NULL, NULL },
+
+ Note that this MUST be the last layout in your list!
+
+== YOU PROBABLY SHOULD ==
+(1). Add a key binding for 'cyclelayout' that will allow you to cycle layouts. An example taken from the original diff file looks like this:
+
+ { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } },
+ { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } },
+
diff --git a/cyclelayouts/cyclelayouts.patch b/cyclelayouts/cyclelayouts.patch
@@ -0,0 +1,56 @@
+diff --git a/dwm.1 b/dwm.1
+index 13b3729..165891b 100644
+--- a/dwm.1
++++ b/dwm.1
+@@ -92,6 +92,12 @@ Sets monocle layout.
+ .B Mod1\-space
+ Toggles between current and previous layout.
+ .TP
++.B Mod1\-Control\-,
++Cycles backwards in layout list.
++.TP
++.B Mod1\-Control\-.
++Cycles forwards in layout list.
++.TP
+ .B Mod1\-j
+ Focus next window.
+ .TP
+diff --git a/dwm.c b/dwm.c
+index bb95e26..db73000 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -157,6 +157,7 @@ static void configure(Client *c);
+ static void configurenotify(XEvent *e);
+ static void configurerequest(XEvent *e);
+ static Monitor *createmon(void);
++static void cyclelayout(const Arg *arg);
+ static void destroynotify(XEvent *e);
+ static void detach(Client *c);
+ static void detachstack(Client *c);
+@@ -645,6 +646,23 @@ createmon(void)
+ }
+
+ void
++cyclelayout(const Arg *arg) {
++ Layout *l;
++ for(l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++);
++ if(arg->i > 0) {
++ if(l->symbol && (l + 1)->symbol)
++ setlayout(&((Arg) { .v = (l + 1) }));
++ else
++ setlayout(&((Arg) { .v = layouts }));
++ } else {
++ if(l != layouts && (l - 1)->symbol)
++ setlayout(&((Arg) { .v = (l - 1) }));
++ else
++ setlayout(&((Arg) { .v = &layouts[LENGTH(layouts) - 2] }));
++ }
++}
++
++void
+ destroynotify(XEvent *e)
+ {
+ Client *c;
+--
+2.7.4
+