commit 5f314d06aadefb8b05013efb1d1425ae95b06893
Author: GasparVardanyan <[email protected]>
Date:   Mon Nov 21 18:17:17 2022 +0400

    [dwm][namedscratchpads]: new sub-patch: scratchtagwins

diff --git 
a/dwm.suckless.org/patches/namedscratchpads/dwm-scratchtagwins-6.3.diff 
b/dwm.suckless.org/patches/namedscratchpads/dwm-scratchtagwins-6.3.diff
new file mode 100644
index 00000000..aacc8fb1
--- /dev/null
+++ b/dwm.suckless.org/patches/namedscratchpads/dwm-scratchtagwins-6.3.diff
@@ -0,0 +1,120 @@
+diff --git a/config.def.h b/config.def.h
+index a2ac963..ae54a10 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -21,6 +21,8 @@ static const char *colors[][3]      = {
+ /* tagging */
+ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+ 
++#include "scratchtagwins.c"
++
+ static const Rule rules[] = {
+       /* xprop(1):
+        *      WM_CLASS(STRING) = instance, class
+@@ -29,6 +31,15 @@ static const Rule rules[] = {
+       /* class      instance    title       tags mask     isfloating   
monitor */
+       { "Gimp",     NULL,       NULL,       0,            1,           -1 },
+       { "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
++      SCRATCHTAGWIN_RULE (scratchtagwin1, 1),
++      SCRATCHTAGWIN_RULE (scratchtagwin2, 2),
++      SCRATCHTAGWIN_RULE (scratchtagwin3, 3),
++      SCRATCHTAGWIN_RULE (scratchtagwin4, 4),
++      SCRATCHTAGWIN_RULE (scratchtagwin5, 5),
++      SCRATCHTAGWIN_RULE (scratchtagwin6, 6),
++      SCRATCHTAGWIN_RULE (scratchtagwin7, 7),
++      SCRATCHTAGWIN_RULE (scratchtagwin8, 8),
++      SCRATCHTAGWIN_RULE (scratchtagwin9, 9),
+ };
+ 
+ /* layout(s) */
+@@ -60,10 +71,31 @@ 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 };
+ 
++SCRATCHTAGWIN (scratchtagwin1, 1);
++SCRATCHTAGWIN (scratchtagwin2, 2);
++SCRATCHTAGWIN (scratchtagwin3, 3);
++SCRATCHTAGWIN (scratchtagwin4, 4);
++SCRATCHTAGWIN (scratchtagwin5, 5);
++SCRATCHTAGWIN (scratchtagwin6, 6);
++SCRATCHTAGWIN (scratchtagwin7, 7);
++SCRATCHTAGWIN (scratchtagwin8, 8);
++SCRATCHTAGWIN (scratchtagwin9, 9);
++
+ static Key keys[] = {
+       /* modifier                     key        function        argument */
+       { MODKEY,                       XK_p,      spawn,          {.v = 
dmenucmd } },
+       { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = 
termcmd } },
++      SCRATCHTAGWIN_KEY (scratchtagwin1, 1)
++      SCRATCHTAGWIN_KEY (scratchtagwin2, 2)
++      SCRATCHTAGWIN_KEY (scratchtagwin3, 3)
++      SCRATCHTAGWIN_KEY (scratchtagwin4, 4)
++      SCRATCHTAGWIN_KEY (scratchtagwin5, 5)
++      SCRATCHTAGWIN_KEY (scratchtagwin6, 6)
++      SCRATCHTAGWIN_KEY (scratchtagwin7, 7)
++      SCRATCHTAGWIN_KEY (scratchtagwin8, 8)
++      SCRATCHTAGWIN_KEY (scratchtagwin9, 9)
++      { MODKEY|AltMask|ShiftMask,     XK_0,  makescratchtagwin,  {.i = 0} },
++      { MODKEY|AltMask|ShiftMask,     XK_s,  makescratchtagwin,  {.i = 's'} },
+       { MODKEY,                       XK_b,      togglebar,      {0} },
+       { MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
+       { MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
+diff --git a/scratchtagwins.c b/scratchtagwins.c
+new file mode 100644
+index 0000000..bf43b17
+--- /dev/null
++++ b/scratchtagwins.c
+@@ -0,0 +1,53 @@
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#include <X11/XF86keysym.h>
++
++# define SCRATCHTAGWIN(name, id)                                              
                \
++      static const char * name [] = { # id,                                   
        \
++              "tabbed",                                                       
                                        \
++                      "-p", "s+1",                                            
                                \
++                      "-n", # name,                                           
                                \
++                      "-g", "1195x672",                                       
                                \
++                      "-c", "st", "-w",                                       
                                \
++              NULL                                                            
                                        \
++      }                                                                       
                                                \
++
++# define SCRATCHTAGWIN_RULE(name, id)                                         
                                                                                
        \
++      { NULL,       # name, NULL,       0,            1,           1,         
  -1,      '0' + id }           \
++
++# define SCRATCHTAGWIN_KEY(name, id)                                          
                                                                \
++      { MODKEY|AltMask,          XK_ ## id,      togglescratch,  {.v = name } 
},                              \
++      { MODKEY|AltMask|ShiftMask,XK_ ## id,      makescratchtagwin,{.i = '0' 
+ id } },                \
++
++static void makescratchtagwin (const Arg * arg)
++{
++      if (selmon -> sel)
++      {
++              if (arg -> i != 0)
++              {
++                      _Bool exists = 0;
++
++                      for (Client * c = selmon -> clients; c; c = c -> next)
++                              if (c -> scratchkey == arg -> i)
++                              {
++                                      exists = 1;
++                                      break;
++                              }
++
++                      if (exists) return;
++              }
++
++              selmon -> sel -> scratchkey = arg -> i;
++              if (arg -> i != 0)
++              {
++                      selmon -> sel -> tags = 0,
++                      selmon -> sel -> isfloating = 1;
++              }
++              else
++                      selmon -> sel -> tags = selmon -> tagset [selmon -> 
seltags];
++              focus (selmon -> sel);
++              arrange (selmon);
++      }
++}
diff --git a/dwm.suckless.org/patches/namedscratchpads/index.md 
b/dwm.suckless.org/patches/namedscratchpads/index.md
index c10d9723..c5921acc 100644
--- a/dwm.suckless.org/patches/namedscratchpads/index.md
+++ b/dwm.suckless.org/patches/namedscratchpads/index.md
@@ -13,10 +13,15 @@ A new field in the rules array is added to associate the 
command with the corres
 
 Works well with [floatrules](../floatrules/) for window positioning.
 
+Apply the scratchtagwins patch on top of this patch, to have 'scratchpad tags'
+support. Contribute to this sub-patch on this [gitlab 
repo](https://gitlab.com/GasparVardanyan/dwm/-/tree/scratchtagwins).
+
 Download
 --------
 * [dwm-namedscratchpads-6.2.diff](dwm-namedscratchpads-6.2.diff)
+  * [dwm-scratchtagwins-6.3.diff](dwm-scratchtagwins-6.3.diff)
 
-Author
-------
+Authors
+-------
 * Joshua O'Connor <[email protected]>
+* [Gaspar Vardanyan](https://gasparvardanyan.github.io/) (scratchtagwins)


Reply via email to