Adding rotatestack patch

pull/32/head
bakkeby 5 years ago
parent 2f4916a64e
commit 7c23a59c38

@ -11,7 +11,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2019-09-07 - Added cyclelayouts patch
2019-09-07 - Added cyclelayouts, resizecorners and rotatestack patch
2019-09-06 - Added attachabove, attachaside, attachbelow, attachbottom, autostart, fancybar, focusonnetactive and losefullscreen patches
@ -59,6 +59,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- by default, windows only resize from the bottom right corner
- with this patch the mouse is warped to the nearest corner and you resize from there
- [rotatestack](https://dwm.suckless.org/patches/rotatestack/)
- let's you rotate through the stack using keyboard shortcuts
- [systray](https://dwm.suckless.org/patches/systray/)
- adds system tray in the status bar

@ -84,6 +84,10 @@ static Key keys[] = {
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
#if ROTATESTACK_PATCH
{ MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
{ MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
#endif // ROTATESTACK_PATCH
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },

@ -18,6 +18,10 @@
#include "pertag.c"
#endif
#if ROTATESTACK_PATCH
#include "rotatestack.c"
#endif
#if SYSTRAY_PATCH
#include "systray.c"
#endif

@ -12,7 +12,11 @@
#if CYCLELAYOUTS_PATCH
#include "cyclelayouts.h"
#endif // CYCLELAYOUTS_PATCH
#endif
#if ROTATESTACK_PATCH
#include "rotatestack.h"
#endif
#if SYSTRAY_PATCH
#include "systray.h"

@ -0,0 +1,52 @@
void
enqueue(Client *c)
{
Client *l;
for (l = c->mon->clients; l && l->next; l = l->next);
if (l) {
l->next = c;
c->next = NULL;
}
}
void
enqueuestack(Client *c)
{
Client *l;
for (l = c->mon->stack; l && l->snext; l = l->snext);
if (l) {
l->snext = c;
c->snext = NULL;
}
}
void
rotatestack(const Arg *arg)
{
Client *c = NULL, *f;
if (!selmon->sel)
return;
f = selmon->sel;
if (arg->i > 0) {
for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next));
if (c){
detach(c);
attach(c);
detachstack(c);
attachstack(c);
}
} else {
if ((c = nexttiled(selmon->clients))){
detach(c);
enqueue(c);
detachstack(c);
enqueuestack(c);
}
}
if (c){
arrange(selmon);
focus(f);
restack(selmon);
}
}

@ -0,0 +1,3 @@
static void enqueue(Client *c);
static void enqueuestack(Client *c);
static void rotatestack(const Arg *arg);

@ -87,6 +87,11 @@
*/
#define RESIZECORNERS_PATCH 0
/* This patch let's you rotate through the stack using keyboard shortcuts.
* https://dwm.suckless.org/patches/rotatestack/
*/
#define ROTATESTACK_PATCH 0
/* The systray patch adds systray for the status bar.
* https://dwm.suckless.org/patches/systray/
*/

Loading…
Cancel
Save