Add tagallmon function - dwm - [fork] dynamic window manager
 (HTM) git clone https://git.drkhsh.at/dwm.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 5e40d5c2fafc4aafcebecb5e0551056bc4270d5c
 (DIR) parent e840929f876d177d801b59dd5c13b46de3aecd12
 (HTM) Author: drkhsh <me@drkhsh.at>
       Date:   Mon, 10 Jan 2022 13:48:33 +0100
       
       Add tagallmon function
       
       Move all visible windows to an adjacent monitor
       
       https://github.com/bakkeby/patches/blob/master/dwm/dwm-tagallmon-6.3.diff
       
       Diffstat:
         M config.def.h                        |       3 +++
         A tagallmon.c                         |      44 +++++++++++++++++++++++++++++++
       
       2 files changed, 47 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/config.def.h b/config.def.h
       @@ -67,6 +67,7 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() 
        static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
        static const char *termcmd[]  = { "st", NULL };
        
       +#include "tagallmon.c"
        static const Key keys[] = {
                /* modifier                     key        function        argument */
                { MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
       @@ -92,6 +93,8 @@ static const Key keys[] = {
                { MODKEY,                       XK_period, focusmon,       {.i = +1 } },
                { MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
                { MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
       +        { MODKEY|Mod4Mask|ShiftMask,    XK_comma,  tagallmon,      {.i = +1 } },
       +        { MODKEY|Mod4Mask|ShiftMask,    XK_period, tagallmon,      {.i = -1 } },
                TAGKEYS(                        XK_1,                      0)
                TAGKEYS(                        XK_2,                      1)
                TAGKEYS(                        XK_3,                      2)
 (DIR) diff --git a/tagallmon.c b/tagallmon.c
       @@ -0,0 +1,44 @@
       +static void tagallmon(const Arg *arg);
       +
       +void
       +tagallmon(const Arg *arg)
       +{
       +        Monitor *m;
       +        Client *c, *last, *slast, *next;
       +
       +        if (!mons->next)
       +                return;
       +
       +        m = dirtomon(arg->i);
       +        for (last = m->clients; last && last->next; last = last->next);
       +        for (slast = m->stack; slast && slast->snext; slast = slast->snext);
       +
       +        for (c = selmon->clients; c; c = next) {
       +                next = c->next;
       +                if (!ISVISIBLE(c))
       +                        continue;
       +                unfocus(c, 1);
       +                detach(c);
       +                detachstack(c);
       +                c->mon = m;
       +                c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
       +                c->next = NULL;
       +                c->snext = NULL;
       +                if (last)
       +                        last = last->next = c;
       +                else
       +                        m->clients = last = c;
       +                if (slast)
       +                        slast = slast->snext = c;
       +                else
       +                        m->stack = slast = c;
       +                if (c->isfullscreen) {
       +                        resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
       +                        XRaiseWindow(dpy, c->win);
       +                }
       +        }
       +
       +        focus(NULL);
       +        arrange(NULL);
       +}
       +