commit 2325ef44cfb54f3af693e02dd79ebf1e468246e3
parent 08e2d23598fde1cf347f8203db0325fc84a1ab9b
Author: Miles Alan <m@milesalan.com>
Date: Sun, 26 Apr 2020 17:27:21 -0500
Transferall patch
Diffstat:
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -128,7 +128,9 @@ static Key keys[] = {
{ 0, MODKEY|ShiftMask, XK_q, killclient, {0} },
{ 0, MODKEY, XK_semicolon, switchcol, {0} },
- { 0, MODKEY, XK_t, transfer, {0} },
+
+ { 1, MODKEY, XK_t, transfer, {0} },
+ { 2, MODKEY, XK_t, transferall, {0} },
/* float */
{ 0, MODKEY, XK_n, setlayout, {.v = &layouts[1]} },
diff --git a/dwm.c b/dwm.c
@@ -232,6 +232,7 @@ 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 transferall(const Arg *arg);
static void unfloatvisible(const Arg *arg);
static void unfocus(Client *c, int setfocus);
static void unmanage(Client *c, int destroyed);
@@ -2916,4 +2917,29 @@ transfer(const Arg *arg) {
}
}
arrange(selmon);
-}
-\ No newline at end of file
+}
+
+void
+transferall(const Arg *arg) {
+ Client *c, *n = selmon->clients, *attachfrom = NULL;
+ int i = 0, nstackclients = 0;
+ while (n) {
+ c = n;
+ n = c->next;
+ if (!ISVISIBLE(c) || c->isfloating) continue;
+ if (i >= selmon->nmaster) {
+ detach(c);
+ if (!attachfrom) {
+ attach(c);
+ } else {
+ c->next = attachfrom->next;
+ attachfrom->next = c;
+ }
+ attachfrom = c;
+ nstackclients++;
+ }
+ i++;
+ }
+ selmon->nmaster = nstackclients;
+ arrange(selmon);
+}