Adding transfer patch

pull/32/head
bakkeby 4 years ago
parent 60209c98d7
commit 84b0361b65

@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2020-01-26 - Added transfer patch
2020-01-24 - Added barpadding patch (incl. statusallmons, statuspadding, statuscolors, systray, alpha, holdbar and extrabar patch compatibility). Moved patches.h to patches.def.h to mimic the config pattern of having default and personal settings.
2020-01-17 - Added inplacerotate patch
@ -325,6 +327,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [togglefullscreen](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-togglefullscreen-6.2.diff)
- allows you to toggle fullscreen on and off using a single shortcut key
- [transfer](https://dwm.suckless.org/patches/transfer/)
- lets you transfer the currently focused client between the master and stack area while increasing or decreasing the master area (nmaster) accordingly
- [unfloatvisible](https://dwm.suckless.org/patches/unfloatvisible/)
- resets isfloating on any visible windows that have it set and optionally also applies a layout

@ -559,6 +559,9 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } },
{ MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } },
#endif // MOVESTACK_PATCH
#if TRANSFER_PATCH
{ MODKEY, XK_x, transfer, {0} },
#endif // TRANSFER_PATCH
{ MODKEY, XK_Return, zoom, {0} },
#if VANITYGAPS_PATCH
{ MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } },

@ -120,6 +120,9 @@
#if TOGGLEFULLSCREEN_PATCH
#include "togglefullscreen.c"
#endif
#if TRANSFER_PATCH
#include "transfer.c"
#endif
#if UNFLOATVISIBLE_PATCH
#include "unfloatvisible.c"
#endif

@ -120,6 +120,9 @@
#if TOGGLEFULLSCREEN_PATCH
#include "togglefullscreen.h"
#endif
#if TRANSFER_PATCH
#include "transfer.h"
#endif
#if UNFLOATVISIBLE_PATCH
#include "unfloatvisible.h"
#endif

@ -0,0 +1,33 @@
void
transfer(const Arg *arg)
{
Client *c, *mtail = selmon->clients, *stail = NULL, *insertafter;
int transfertostack = 0, i, nmasterclients;
for (i = 0, c = selmon->clients; c; c = c->next) {
if (!ISVISIBLE(c) || c->isfloating) continue;
if (selmon->sel == c) { transfertostack = i < selmon->nmaster && selmon->nmaster != 0; }
if (i < selmon->nmaster) { nmasterclients++; mtail = c; }
stail = c;
i++;
}
if (selmon->sel->isfloating || i == 0) {
return;
} else if (transfertostack) {
selmon->nmaster = MIN(i, selmon->nmaster) - 1;
insertafter = stail;
} else {
selmon->nmaster = selmon->nmaster + 1;
insertafter = mtail;
}
if (insertafter != selmon->sel) {
detach(selmon->sel);
if (selmon->nmaster == 1 && !transfertostack) {
attach(selmon->sel); // Head prepend case
} else {
selmon->sel->next = insertafter->next;
insertafter->next = selmon->sel;
}
}
arrange(selmon);
}

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

@ -512,6 +512,12 @@
*/
#define TOGGLEFULLSCREEN_PATCH 0
/* Lets you transfer the currently focused client between the master and stack area
* while increasing or decreasing the master area (nmaster) accordingly.
* https://dwm.suckless.org/patches/transfer/
*/
#define TRANSFER_PATCH 0
/* This patch resets isfloating on any visible windows that have it set.
* Optionally also applies a layout.
* https://dwm.suckless.org/patches/unfloatvisible/

Loading…
Cancel
Save