[wiki] [sites] [dwm][patch][multipledynamicscratchpads] some fixes || GasparVardanyan
commit b53b0393c5a8335e896ca0a3fb489b61399fb055
Author: GasparVardanyan <gaspar.vardanyan.mailbox_AT_gmail.com>
Date: Mon Jan 24 05:29:32 2022 +0400
[dwm][patch][multipledynamicscratchpads] some fixes
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 1d0892a1..d72e4e09 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,7 +14,7 @@ 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
_AT_@ -35,22 +35,22 @@ 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 512
-+#define SCRATCHPAD_MASK_2 1024
-+#define SCRATCHPAD_MASK_3 2048
++#define SCRATCHPAD_MASK_1 (1u << sizeof tags / sizeof * tags)
++#define SCRATCHPAD_MASK_2 (1u << (sizeof tags / sizeof * tags + 1))
++#define SCRATCHPAD_MASK_3 (1u << (sizeof tags / sizeof * tags + 2))
+static int scratchpad_hide_flag = 0;
+static Client *scratchpad_last_showed_1 = NULL;
+static Client *scratchpad_last_showed_2 = NULL;
+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) > 30 ? -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)
}
}
-
+
+static void scratchpad_hide(const Arg *arg) {
+ if(scratchpad_hide_flag < 4) {
+ if(arg->i == 1) {
_AT_@ -193,7 +193,7 @@ index 5e4d494..8e6fe18 100644
+ scratchpad_last_showed_1 = NULL;
+ }
+ if(scratchpad_last_showed_2 == c) {
-+ scratchpad_last_showed_2 = NULL;
++ scratchpad_last_showed_2 = NULL;
+ }
+ if(scratchpad_last_showed_3 == c) {
+ scratchpad_last_showed_3 = NULL;
diff --git a/dwm.suckless.org/patches/multipledynamicscratchpads/index.md b/dwm.suckless.org/patches/multipledynamicscratchpads/index.md
index 09d57fdb..5a972f3d 100644
--- a/dwm.suckless.org/patches/multipledynamicscratchpads/index.md
+++ b/dwm.suckless.org/patches/multipledynamicscratchpads/index.md
_AT_@ -1,5 +1,5 @@
multipledynamicscratchpads
-==========
+==========================
Description
-----------
_AT_@ -7,7 +7,7 @@ The scratchpad patch allows you to spawn or restore a multiple floating windows.
It is usually useful to have multiple windows spawn and hidden quickly using individual keys.
By default your keybinding are `MODKEY+XK_{s, y, u}` to to show scratchpad,
-`MODKEY|ShiftMask+XK_{s, y, u}` to create a scratchpad and
+`MODKEY|ShiftMask+XK_{s, y, u}` to create a scratchpad and
`MODKEY|ShiftMask+XK_r` to remove scratchpad.
A `config.def.h` change is included in the patch.
_AT_@ -18,4 +18,4 @@ Download
Authors
-------
-* Anukul Adhikari <hi_AT_anukul.com.np>
+* Anukul Adhikari <hi_AT_anukul.com.np>
Received on Mon Jan 24 2022 - 02:29:36 CET
This archive was generated by hypermail 2.3.0
: Mon Jan 24 2022 - 02:36:44 CET