[wiki] [sites] [dwm][patch]fixed bug on spawning new scratchpad || anukul

From: <git_AT_suckless.org>
Date: Sun, 10 Apr 2022 09:03:22 +0200

commit d5f71c488817ac45436d22737998f55472071aa0
Author: anukul <hi_AT_anukul.com.np>
Date: Sun Apr 10 12:38:54 2022 +0545

    [dwm][patch]fixed bug on spawning new scratchpad

diff --git a/dwm.suckless.org/patches/multipledynamicscratchpads/dwm-multiple-dynamic-scratchpads.diff b/dwm.suckless.org/patches/multipledynamicscratchpads/dwm-multiple-dynamic-scratchpads.diff
index d72e4e09..22d00007 100644
--- a/dwm.suckless.org/patches/multipledynamicscratchpads/dwm-multiple-dynamic-scratchpads.diff
+++ b/dwm.suckless.org/patches/multipledynamicscratchpads/dwm-multiple-dynamic-scratchpads.diff
_AT_@ -14,10 +14,10 @@ index a2ac963..1c82453 100644
 + { MODKEY|ShiftMask, XK_u, scratchpad_hide, {.i = 3} },
 + { MODKEY|ShiftMask, XK_r, scratchpad_remove, {0} },
  };
-
+
  /* button definitions */
 diff --git a/dwm.c b/dwm.c
-index 5e4d494..8e6fe18 100644
+index 5f16260..202038f 100644
 --- a/dwm.c
 +++ b/dwm.c
 _AT_@ -195,6 +195,11 @@ static void resizemouse(const Arg *arg);
_AT_@ -35,7 +35,7 @@ index 5e4d494..8e6fe18 100644
 _AT_@ -269,11 +274,19 @@ static Drw *drw;
  static Monitor *mons, *selmon;
  static Window root, wmcheckwin;
-
+
 +/* scratchpad */
 +#define SCRATCHPAD_MASK_1 (1u << sizeof tags / sizeof * tags)
 +#define SCRATCHPAD_MASK_2 (1u << (sizeof tags / sizeof * tags + 1))
_AT_@ -46,11 +46,11 @@ index 5e4d494..8e6fe18 100644
 +static Client *scratchpad_last_showed_3 = NULL;
  /* configuration, allows nested code to access above variables */
  #include "config.h"
-
+
  /* compile-time check if all tags fit into an unsigned int bit array. */
 -struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
 +struct NumTags { char limitexceeded[LENGTH(tags) > 28 ? -1 : 1]; };
-
+
  /* function implementations */
  void
 _AT_@ -309,7 +322,9 @@ applyrules(Client *c)
_AT_@ -61,12 +61,12 @@ index 5e4d494..8e6fe18 100644
          c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
 + }
  }
-
+
  int
-_AT_@ -1408,6 +1423,121 @@ scan(void)
+_AT_@ -1412,6 +1427,124 @@ scan(void)
          }
  }
-
+
 +static void scratchpad_hide(const Arg *arg) {
 + if(scratchpad_hide_flag < 4) {
 + if(arg->i == 1) {
_AT_@ -103,12 +103,15 @@ index 5e4d494..8e6fe18 100644
 + if(selmon->sel && (scratchpad_last_showed_1 != NULL || scratchpad_last_showed_2 != NULL ||scratchpad_last_showed_3 != NULL) && (selmon->sel == scratchpad_last_showed_1 || selmon->sel == scratchpad_last_showed_2 || selmon->sel == scratchpad_last_showed_3)) {
 + if(scratchpad_last_showed_1 == selmon->sel) {
 + scratchpad_last_showed_1 = NULL;
++ scratchpad_hide_flag--;
 + }
 + else if(scratchpad_last_showed_2 == selmon->sel) {
 + scratchpad_last_showed_2 = NULL;
++ scratchpad_hide_flag--;
 + }
 + else if(scratchpad_last_showed_3 == selmon->sel) {
 + scratchpad_last_showed_3 = NULL;
++ scratchpad_hide_flag--;
 + }
 + }
 +}
_AT_@ -185,7 +188,7 @@ index 5e4d494..8e6fe18 100644
  void
  sendmon(Client *c, Monitor *m)
  {
-_AT_@ -1781,6 +1911,16 @@ unmanage(Client *c, int destroyed)
+_AT_@ -1785,6 +1918,16 @@ unmanage(Client *c, int destroyed)
                  XSetErrorHandler(xerror);
                  XUngrabServer(dpy);
          }
diff --git a/dwm.suckless.org/patches/multipledynamicscratchpads/index.md b/dwm.suckless.org/patches/multipledynamicscratchpads/index.md
index 5a972f3d..c4e71272 100644
--- a/dwm.suckless.org/patches/multipledynamicscratchpads/index.md
+++ b/dwm.suckless.org/patches/multipledynamicscratchpads/index.md
_AT_@ -14,7 +14,7 @@ A `config.def.h` change is included in the patch.
 
 Download
 --------
-* [dwm-multiple-dynamic-scratchpads.diff](dwm-multiple-dynamic-scratchpads.diff) - 2021-10-30
+* [dwm-multiple-dynamic-scratchpads.diff](dwm-multiple-dynamic-scratchpads.diff) - 2022-04-10
 
 Authors
 -------
Received on Sun Apr 10 2022 - 09:03:22 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 10 2022 - 09:12:50 CEST