Adding inplacerotate patch

pull/32/head
bakkeby 4 years ago
parent bf4fdc6484
commit 83a7b16a86

@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2020-01-17 - Added inplacerotate patch
2019-12-15 - Updated dragmfact patch to include fix patch to make it work with multiple monitors
2019-11-26 - Added dmenumatchtop patch, added improvements to the switchtag patch based on ideas from the switchtotag patch
@ -190,6 +192,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- sometimes dwm crashes when it cannot render some glyphs in window titles (usually emoji)
- this patch is essentially a hack to ignore any errors when drawing text on the status bar and may be removed if a more appropriate solution comes up
- [inplacerotate](https://dwm.suckless.org/patches/inplacerotate/)
- allows rotation of all clients in the master or stack area without affecting the other area
- [ispermanent](https://dwm.suckless.org/patches/ispermanent/)
- adds rule option for clients to avoid accidental termination by killclient for sticky windows

@ -530,6 +530,10 @@ static Key keys[] = {
{ MODKEY|Mod4Mask, XK_j, rotatestack, {.i = +1 } },
{ MODKEY|Mod4Mask, XK_k, rotatestack, {.i = -1 } },
#endif // ROTATESTACK_PATCH
#if INPLACEROTATE_PATCH
{ MODKEY|Mod4Mask|ShiftMask, XK_j, inplacerotate, {.i = +1} },
{ MODKEY|Mod4Mask|ShiftMask, XK_k, inplacerotate, {.i = -1} },
#endif // INPLACEROTATE_PATCH
#if PUSH_PATCH || PUSH_NO_MASTER_PATCH
{ MODKEY|ControlMask, XK_j, pushdown, {0} },
{ MODKEY|ControlMask, XK_k, pushup, {0} },

@ -32,6 +32,9 @@
#if EWMHTAGS_PATCH
#include "ewmhtags.c"
#endif
#if EXRESIZE_PATCH
#include "exresize.c"
#endif
#if FAKEFULLSCREEN_CLIENT_PATCH
#include "fakefullscreenclient.c"
#endif
@ -47,8 +50,8 @@
#if HOLDBAR_PATCH
#include "holdbar.c"
#endif
#if EXRESIZE_PATCH
#include "exresize.c"
#if INPLACEROTATE_PATCH
#include "inplacerotate.c"
#endif
#if KILLUNSEL_PATCH
#include "killunsel.c"

@ -50,6 +50,9 @@
#if HOLDBAR_PATCH
#include "holdbar.h"
#endif
#if INPLACEROTATE_PATCH
#include "inplacerotate.h"
#endif
#if KILLUNSEL_PATCH
#include "killunsel.h"
#endif

@ -0,0 +1,53 @@
void
insertclient(Client *item, Client *insertItem, int after)
{
Client *c;
if (item == NULL || insertItem == NULL || item == insertItem) return;
detach(insertItem);
if (!after && selmon->clients == item) {
attach(insertItem);
return;
}
if (after) {
c = item;
} else {
for (c = selmon->clients; c; c = c->next) { if (c->next == item) break; }
}
insertItem->next = c->next;
c->next = insertItem;
}
void
inplacerotate(const Arg *arg)
{
if (!selmon->sel || (selmon->sel->isfloating && !arg->f)) return;
unsigned int selidx = 0, i = 0;
Client *c = NULL, *stail = NULL, *mhead = NULL, *mtail = NULL, *shead = NULL;
// Shift client
for (c = selmon->clients; c; c = c->next) {
if (ISVISIBLE(c) && !(c->isfloating)) {
if (selmon->sel == c) { selidx = i; }
if (i == selmon->nmaster - 1) { mtail = c; }
if (i == selmon->nmaster) { shead = c; }
if (mhead == NULL) { mhead = c; }
stail = c;
i++;
}
}
if (arg->i < 0 && selidx >= selmon->nmaster) insertclient(stail, shead, 1);
if (arg->i > 0 && selidx >= selmon->nmaster) insertclient(shead, stail, 0);
if (arg->i < 0 && selidx < selmon->nmaster) insertclient(mtail, mhead, 1);
if (arg->i > 0 && selidx < selmon->nmaster) insertclient(mhead, mtail, 0);
// Restore focus position
i = 0;
for (c = selmon->clients; c; c = c->next) {
if (!ISVISIBLE(c) || (c->isfloating)) continue;
if (i == selidx) { focus(c); break; }
i++;
}
arrange(selmon);
focus(c);
}

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

@ -233,6 +233,12 @@
*/
#define HOLDBAR_PATCH 0
/* This patch provides a keybinding to rotate all clients in the currently selected
* area (master or stack) without affecting the other area.
* https://dwm.suckless.org/patches/inplacerotate/
*/
#define INPLACEROTATE_PATCH 0
/* Adds rule option for clients to avoid accidental termination by killclient for sticky windows.
* https://dwm.suckless.org/patches/ispermanent/
*/
@ -355,7 +361,7 @@
*/
#define ROTATESTACK_PATCH 0
/* This patch aves size and position of every floating window before it is forced
/* This patch saves size and position of every floating window before it is forced
* into tiled mode. If the window is made floating again then the old dimensions
* will be restored.
* https://dwm.suckless.org/patches/save_floats/

Loading…
Cancel
Save