Adding cyclelayouts patch

This commit is contained in:
bakkeby 2019-09-07 22:27:06 +02:00
parent 27b6b4b024
commit 9ccc131284
7 changed files with 42 additions and 1 deletions

View File

@ -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

View File

@ -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} },
};

16
patch/cyclelayouts.c Normal file
View File

@ -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] }));
}
}

1
patch/cyclelayouts.h Normal file
View File

@ -0,0 +1 @@
static void cyclelayout(const Arg *arg);

View File

@ -10,6 +10,10 @@
#include "autostart.c"
#endif
#if CYCLELAYOUTS_PATCH
#include "cyclelayouts.c"
#endif // CYCLELAYOUTS_PATCH
#if PERTAG_PATCH
#include "pertag.c"
#endif

View File

@ -10,6 +10,10 @@
#include "autostart.h"
#endif
#if CYCLELAYOUTS_PATCH
#include "cyclelayouts.h"
#endif // CYCLELAYOUTS_PATCH
#if SYSTRAY_PATCH
#include "systray.h"
#endif

View File

@ -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/