2020-05-01 20:54:26 +00:00
|
|
|
From bb98aa123fe3490aa731a16e95fe8b4d30d7fe5e Mon Sep 17 00:00:00 2001
|
Adding attachx, autostart, center, cyclelayouts, fancybar, flextile, focusonnetactive, losefullscreen, pertag, resizecorners, rotatestack, savefloats, single-tagset, statuspadding, switchtag, systray, tagallmon, tagmonfixfs, tagswapmon, togglefullscreen, windowrolerule and zoomswap patches
2020-04-07 16:24:23 +00:00
|
|
|
From: bakkeby <bakkeby@gmail.com>
|
2020-05-01 20:54:26 +00:00
|
|
|
Date: Fri, 1 May 2020 22:20:25 +0200
|
Adding attachx, autostart, center, cyclelayouts, fancybar, flextile, focusonnetactive, losefullscreen, pertag, resizecorners, rotatestack, savefloats, single-tagset, statuspadding, switchtag, systray, tagallmon, tagmonfixfs, tagswapmon, togglefullscreen, windowrolerule and zoomswap patches
2020-04-07 16:24:23 +00:00
|
|
|
Subject: [PATCH] cyclelayout, function to cycle through available layouts.
|
|
|
|
|
|
|
|
MOD-CTRL-, and MOD-CTRL-.
|
|
|
|
cycle backwards and forwards through available layouts.
|
|
|
|
Probably only useful if you have a lot of additional layouts.
|
|
|
|
The NULL, NULL layout should always be the last layout in your list,
|
|
|
|
in order to guarantee consistent behavior.
|
|
|
|
|
|
|
|
Refer to https://dwm.suckless.org/patches/cyclelayouts/
|
|
|
|
---
|
|
|
|
config.def.h | 3 +++
|
|
|
|
dwm.1 | 6 ++++++
|
|
|
|
dwm.c | 18 ++++++++++++++++++
|
|
|
|
3 files changed, 27 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
|
|
index 1c0b587..9a71a37 100644
|
|
|
|
--- a/config.def.h
|
|
|
|
+++ b/config.def.h
|
|
|
|
@@ -41,6 +41,7 @@ static const Layout layouts[] = {
|
|
|
|
{ "[]=", tile }, /* first entry is default */
|
|
|
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
|
|
|
{ "[M]", monocle },
|
|
|
|
+ { NULL, NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
/* key definitions */
|
|
|
|
@@ -84,6 +85,8 @@ static Key keys[] = {
|
|
|
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
|
|
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
|
|
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
|
|
|
+ { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } },
|
|
|
|
+ { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } },
|
|
|
|
TAGKEYS( XK_1, 0)
|
|
|
|
TAGKEYS( XK_2, 1)
|
|
|
|
TAGKEYS( XK_3, 2)
|
|
|
|
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 4465af1..26db8e3 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);
|
|
|
|
@@ -644,6 +645,23 @@ createmon(void)
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
|
|
|
+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)
|
|
|
|
{
|
|
|
|
--
|
2020-05-01 20:54:26 +00:00
|
|
|
2.19.1
|
Adding attachx, autostart, center, cyclelayouts, fancybar, flextile, focusonnetactive, losefullscreen, pertag, resizecorners, rotatestack, savefloats, single-tagset, statuspadding, switchtag, systray, tagallmon, tagmonfixfs, tagswapmon, togglefullscreen, windowrolerule and zoomswap patches
2020-04-07 16:24:23 +00:00
|
|
|
|