My configuration of sxmo fork of suckless dwm.

git clone git://watertao.xyz/programs/sxmo-dwm.git

commit d3b5dbec4ffd251df74f2e993d650ea61e9cfbc4
parent fc28f2df97a4c0670efcca54c6cf061ffdc8886d
Author: Miles Alan <m@milesalan.com>
Date:   Sun, 26 Apr 2020 17:08:42 -0500

Transfer patch

Diffstat:
Mconfig.def.h | 1+
Mdwm.c | 35+++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -122,6 +122,7 @@ static Key keys[] = { { 0, MODKEY|ShiftMask, XK_q, killclient, {0} }, { 0, MODKEY, XK_semicolon, switchcol, {0} }, + { 0, MODKEY, XK_t, transfer, {0} }, /* float */ { 0, MODKEY, XK_n, setlayout, {.v = &layouts[1]} }, diff --git a/dwm.c b/dwm.c @@ -231,6 +231,7 @@ static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); +static void transfer(const Arg *arg); static void unfloatvisible(const Arg *arg); static void unfocus(Client *c, int setfocus); static void unmanage(Client *c, int destroyed); @@ -2883,3 +2884,36 @@ inplacerotate(const Arg *arg) arrange(selmon); focus(c); } + +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); +} +\ No newline at end of file