diff --git a/config.def.h b/config.def.h index abc61df..3319c70 100644 --- a/config.def.h +++ b/config.def.h @@ -825,10 +825,6 @@ static const char *statuscmds[] = { "notify-send Mouse$BUTTON" }; static char *statuscmd[] = { "/bin/sh", "-c", NULL, NULL }; #endif // STATUSCMD_PATCH | DWMBLOCKS_PATCH -#if SCRATCHPAD_ALT_1_PATCH -static const unsigned scratchpad_mask = 1u << sizeof tags / sizeof * tags; -#endif // SCRATCHPAD_ALT_1_PATCH - static Key keys[] = { /* modifier key function argument */ #if KEYMODES_PATCH @@ -997,8 +993,6 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_s, togglesticky, {0} }, #endif // STICKY_PATCH #if SCRATCHPAD_ALT_1_PATCH - { MODKEY, XK_0, view, {.ui = ~scratchpad_mask } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~scratchpad_mask } }, { MODKEY, XK_minus, scratchpad_show, {0} }, { MODKEY|ShiftMask, XK_minus, scratchpad_hide, {0} }, { MODKEY, XK_equal, scratchpad_remove, {0} }, diff --git a/dwm.c b/dwm.c index 9d79b5b..8c4097f 100644 --- a/dwm.c +++ b/dwm.c @@ -514,7 +514,11 @@ static Window root, wmcheckwin; #include "patch/include.c" /* compile-time check if all tags fit into an unsigned int bit array. */ +#if SCRATCHPAD_ALT_1_PATCH +struct NumTags { char limitexceeded[LENGTH(tags) > 30 ? -1 : 1]; }; +#else struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; +#endif // SCRATCHPAD_ALT_1_PATCH /* function implementations */ void @@ -606,12 +610,17 @@ applyrules(Client *c) if (c->tags & TAGMASK) c->tags = c->tags & TAGMASK; #if SCRATCHPAD_PATCH else if (c->mon->tagset[c->mon->seltags]) c->tags = c->mon->tagset[c->mon->seltags] & ~SPTAGMASK; + #elif SCRATCHPAD_ALT_1_PATCH + else if (c->tags != SCRATCHPAD_MASK && c->mon->tagset[c->mon->seltags]) c->tags = c->mon->tagset[c->mon->seltags]; #else else if (c->mon->tagset[c->mon->seltags]) c->tags = c->mon->tagset[c->mon->seltags]; #endif // SCRATCHPAD_PATCH else c->tags = 1; #elif SCRATCHPAD_PATCH c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : (c->mon->tagset[c->mon->seltags] & ~SPTAGMASK); + #elif SCRATCHPAD_ALT_1_PATCH + if (c->tags != SCRATCHPAD_MASK) + c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; #else c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; #endif // EMPTYVIEW_PATCH diff --git a/patch/scratchpad_alt_1.c b/patch/scratchpad_alt_1.c index 9d89ac9..8feb49b 100644 --- a/patch/scratchpad_alt_1.c +++ b/patch/scratchpad_alt_1.c @@ -4,7 +4,7 @@ static void scratchpad_hide () { if (selmon -> sel) { - selmon -> sel -> tags = scratchpad_mask; + selmon -> sel -> tags = SCRATCHPAD_MASK; focus(NULL); arrange(selmon); } @@ -36,9 +36,9 @@ static void scratchpad_show () scratchpad_show_first (); else { - if (scratchpad_last_showed -> tags != scratchpad_mask) + if (scratchpad_last_showed -> tags != SCRATCHPAD_MASK) { - scratchpad_last_showed -> tags = scratchpad_mask; + scratchpad_last_showed -> tags = SCRATCHPAD_MASK; focus(NULL); arrange(selmon); } @@ -58,7 +58,7 @@ static void scratchpad_show () } else { - if (c -> tags == scratchpad_mask) + if (c -> tags == SCRATCHPAD_MASK) { found_next = 1; scratchpad_show_client (c); @@ -83,7 +83,7 @@ static void scratchpad_show_first (void) { for (Client * c = selmon -> clients; c != NULL; c = c -> next) { - if (c -> tags == scratchpad_mask) + if (c -> tags == SCRATCHPAD_MASK) { scratchpad_show_client (c); break; diff --git a/patch/scratchpad_alt_1.h b/patch/scratchpad_alt_1.h index 4bbbf9b..6248c88 100644 --- a/patch/scratchpad_alt_1.h +++ b/patch/scratchpad_alt_1.h @@ -1,3 +1,5 @@ +# define SCRATCHPAD_MASK (1u << sizeof tags / sizeof * tags) + static void scratchpad_hide (); static _Bool scratchpad_last_showed_is_killed (void); static void scratchpad_remove ();