t* dwm + patches
       
   URI git clone git://git.codevoid.de/dwm-sdk
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 05d478d8df54322c6b7f4a149f8493495e8aa5ab
   DIR parent 2a88da430896de546000bf2a04f192977776f507
   URI Author: Stefan Hagen <sh+git[at]codevoid[dot]de>
       Date:   Tue,  5 Feb 2019 09:52:47 +0100
       
       Add scratchpad
       
       Diffstat:
         M config.def.h                        |       3 +++
         M config.h                            |       6 ++++++
         M dwm.c                               |      32 +++++++++++++++++++++++++++++++
       
       3 files changed, 41 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/config.def.h b/config.def.h
       t@@ -54,11 +54,14 @@ static const Layout layouts[] = {
        /* commands */
        static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
        static const char *termcmd[]  = { "uxterm", NULL };
       +static const char scratchpadname[] = "scratchpad";
       +static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
        
        static Key keys[] = {
                /* modifier                     key        function        argument */
                { MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
                { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
       +    { MODKEY,                       XK_minus,  togglescratch,  {.v = scratchpadcmd } },
                { MODKEY,                       XK_b,      togglebar,      {0} },
                { MODKEY,                       XK_b,      toggleextrabar, {0} },
                { MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
   DIR diff --git a/config.h b/config.h
       t@@ -61,13 +61,16 @@ static const Layout layouts[] = {
        
        /* helper for spawning shell commands in the pre dwm-5.0 fashion */
        #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
       +static const char scratchpadname[] = "scratchpad";
        
        /* commands */
        static const char *dmenucmd[]    = { "dmenu_run", DMENUOPTS, NULL };
        #ifdef __linux__
       +static const char *scratchpadcmd[] = { "st","-t", scratchpadname, "-g", "120x34", "-e", "mksh", NULL };
        static const char *termcmd[]     = { "st", "-e", "mksh", NULL };
        #else
        static const char *termcmd[]     = { "st", NULL };
       +static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
        #endif
        static const char *notescmd[]    = { "st", "-e", "vim", "Seafile/NotesSync/notes.otl", NULL };
        static const char *browsercmd[]  = { ".dwm/browser", DMENUOPTS, NULL };
       t@@ -77,6 +80,7 @@ static const char *sshot[]       = { ".dwm/sshot", NULL };
        static const char *updateStatus[]       = { "pkill", "-SIGUSR1", "dwmstatus", NULL };
        static const char *unMute[]       = { "mixerctl", "outputs.spkr_mute=off", NULL };
        
       +
        #include "maximize.c"
        static Key keys[] = {
                /* modifier                     key        function        argument */
       t@@ -93,6 +97,8 @@ static Key keys[] = {
            { MODKEY|ShiftMask,             XK_Print,  spawn,          {.v = sshot } },
            { MODKEY|ShiftMask,             XK_o,      spawn,          {.v = notescmd } },
        
       +    { MODKEY,                       XK_minus,  togglescratch,  {.v = scratchpadcmd } },
       +
                { MODKEY,                       XK_b,      togglebar,      {0} },
                { MODKEY,                       XK_b,      toggleextrabar, {0} },
        
   DIR diff --git a/dwm.c b/dwm.c
       t@@ -269,6 +269,7 @@ static void tile(Monitor *);
        static void togglebar(const Arg *arg);
        static void toggleextrabar(const Arg *arg);
        static void togglefloating(const Arg *arg);
       +static void togglescratch(const Arg *arg);
        static void toggletag(const Arg *arg);
        static void toggleview(const Arg *arg);
        static void unfocus(Client *c, Bool setfocus);
       t@@ -346,6 +347,8 @@ struct Pertag {
                Bool showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
        };
        
       +static unsigned int scratchtag = 1 << LENGTH(tags);
       +
        /* compile-time check if all tags fit into an unsigned int bit array. */
        struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
        
       t@@ -1303,6 +1306,13 @@ manage(Window w, XWindowAttributes *wa) {
                           && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
                c->bw = borderpx;
        
       +        if (!strcmp(c->name, scratchpadname)) {
       +                c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag;
       +                c->isfloating = True;
       +                c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
       +                c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
       +        }
       +
                wc.border_width = c->bw;
                XConfigureWindow(dpy, w, CWBorderWidth, &wc);
                XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
       t@@ -2003,6 +2013,28 @@ togglefloating(const Arg *arg) {
        }
        
        void
       +togglescratch(const Arg *arg)
       +{
       +   Client *c;
       +   unsigned int found = 0;
       +
       +   for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
       +   if (found) {
       +       unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
       +       if (newtagset) {
       +           selmon->tagset[selmon->seltags] = newtagset;
       +           focus(NULL);
       +           arrange(selmon);
       +       }
       +       if (ISVISIBLE(c)) {
       +           focus(c);
       +           restack(selmon);
       +       }
       +   } else
       +       spawn(arg);
       +}
       +
       +void
        toggletag(const Arg *arg) {
                unsigned int newtags;