summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2019-09-07 22:27:06 +0200
committerbakkeby <[email protected]>2019-09-07 22:27:06 +0200
commit9ccc131284787b1419389e26d115fecde7266863 (patch)
treebff6863e1046907f441085b7bfa8ba7b1b5b9f4a
parent27b6b4b024948b79950767e38698d45babdca49c (diff)
downloaddwm-flexipatch-9ccc131284787b1419389e26d115fecde7266863.tar.gz
dwm-flexipatch-9ccc131284787b1419389e26d115fecde7266863.zip
Adding cyclelayouts patch
-rw-r--r--README.md5
-rw-r--r--config.def.h8
-rw-r--r--patch/cyclelayouts.c16
-rw-r--r--patch/cyclelayouts.h1
-rw-r--r--patch/include.c4
-rw-r--r--patch/include.h4
-rw-r--r--patches.h5
7 files changed, 42 insertions, 1 deletions
diff --git a/README.md b/README.md
index f6584e5..4b02b5b 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
+2019-09-07 - Added cyclelayouts patch
+
2019-09-06 - Added attachabove, attachaside, attachbelow, attachbottom, autostart, fancybar, focusonnetactive and losefullscreen patches
2019-09-05 - Alpha, systray, togglefullscreen, tagallmon, tagmonfixfs, tagswapmon, pertag and zoomswap patches added
@@ -35,6 +37,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [autostart](https://dwm.suckless.org/patches/autostart/)
- makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup
+ - [cyclelayouts](https://dwm.suckless.org/patches/cyclelayouts/)
+ - let's you cycle through all your layouts
+
- [fancybar](https://dwm.suckless.org/patches/fancybar/)
- shows the titles of all visible windows in the status bar
diff --git a/config.def.h b/config.def.h
index a145750..170f1db 100644
--- a/config.def.h
+++ b/config.def.h
@@ -56,6 +56,9 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ #if CYCLELAYOUTS_PATCH
+ { NULL, NULL },
+ #endif // CYCLELAYOUTS_PATCH
};
/* key definitions */
@@ -110,6 +113,10 @@ static Key keys[] = {
{ MODKEY|Mod4Mask|ControlMask, XK_comma, tagswapmon, {.i = +1 } },
{ MODKEY|Mod4Mask|ControlMask, XK_period, tagswapmon, {.i = -1 } },
#endif // TAGSWAPMON_PATCH
+ #if CYCLELAYOUTS_PATCH
+ { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } },
+ { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } },
+ #endif // CYCLELAYOUTS_PATCH
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
@@ -138,4 +145,3 @@ static Button buttons[] = {
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};
-
diff --git a/patch/cyclelayouts.c b/patch/cyclelayouts.c
new file mode 100644
index 0000000..4fdc873
--- /dev/null
+++ b/patch/cyclelayouts.c
@@ -0,0 +1,16 @@
+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] }));
+ }
+} \ No newline at end of file
diff --git a/patch/cyclelayouts.h b/patch/cyclelayouts.h
new file mode 100644
index 0000000..02c5f9d
--- /dev/null
+++ b/patch/cyclelayouts.h
@@ -0,0 +1 @@
+static void cyclelayout(const Arg *arg); \ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index fa6c20b..0c59c0f 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -10,6 +10,10 @@
#include "autostart.c"
#endif
+#if CYCLELAYOUTS_PATCH
+#include "cyclelayouts.c"
+#endif // CYCLELAYOUTS_PATCH
+
#if PERTAG_PATCH
#include "pertag.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 295ee77..17d6c9e 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -10,6 +10,10 @@
#include "autostart.h"
#endif
+#if CYCLELAYOUTS_PATCH
+#include "cyclelayouts.h"
+#endif // CYCLELAYOUTS_PATCH
+
#if SYSTRAY_PATCH
#include "systray.h"
#endif
diff --git a/patches.h b/patches.h
index 6a9d2ce..d26928a 100644
--- a/patches.h
+++ b/patches.h
@@ -44,6 +44,11 @@
*/
#define AUTOSTART_PATCH 0
+/* The cyclelayouts patch let's you cycle through all your layouts.
+ * https://dwm.suckless.org/patches/cyclelayouts/
+ */
+#define CYCLELAYOUTS_PATCH 0
+
/* This patch shows the titles of all visible windows in the status bar
* (as opposed to showing only the selected one).
* https://dwm.suckless.org/patches/fancybar/