From 795fcc3b51ad2ca84736d7931437e9cffe086832 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Mon, 28 Sep 2020 17:48:49 +0200 Subject: [PATCH] scratchpads: when the scratchpad patch is added, the tagmask is altered, so to get a window onto all tags you have to do ~SPTAGSMASK instead of ~0 as otherwise it will interfere with the scratchpads, ref. #53 --- config.def.h | 3 +++ dwm.c | 9 +++++++-- patch/dwmc.c | 8 ++++++++ patch/pertag.c | 4 ++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index 839ac26..ff93493 100644 --- a/config.def.h +++ b/config.def.h @@ -920,6 +920,9 @@ static Key keys[] = { { MODKEY, XK_minus, scratchpad_show, {0} }, { MODKEY|ShiftMask, XK_minus, scratchpad_hide, {0} }, { MODKEY, XK_equal, scratchpad_remove, {0} }, + #elif SCRATCHPADS_PATCH + { MODKEY, XK_0, view, {.ui = ~SPTAGMASK } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~SPTAGMASK } }, #else { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, diff --git a/dwm.c b/dwm.c index b32b36d..84e3d99 100644 --- a/dwm.c +++ b/dwm.c @@ -3746,14 +3746,19 @@ toggleview(const Arg *arg) selmon->tagset[selmon->seltags] = newtagset; #if PERTAG_PATCH - if (newtagset == ~0) { + #if SCRATCHPADS_PATCH + if (newtagset == ~SPTAGMASK) + #else + if (newtagset == ~0) + #endif // SCRATCHPADS_PATCH + { selmon->pertag->prevtag = selmon->pertag->curtag; selmon->pertag->curtag = 0; } /* test if the user did not select the same tag */ if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) { selmon->pertag->prevtag = selmon->pertag->curtag; - for (i=0; !(newtagset & 1 << i); i++) ; + for (i = 0; !(newtagset & 1 << i); i++) ; selmon->pertag->curtag = i + 1; } diff --git a/patch/dwmc.c b/patch/dwmc.c index 4dedcbc..9c2e863 100644 --- a/patch/dwmc.c +++ b/patch/dwmc.c @@ -13,7 +13,11 @@ viewex(const Arg *arg) void viewallex(const Arg *arg) { + #if SCRATCHPADS_PATCH + view(&((Arg){.ui = ~SPTAGMASK})); + #else view(&((Arg){.ui = ~0})); + #endif // SCRATCHPADS_PATCH } void @@ -37,7 +41,11 @@ toggletagex(const Arg *arg) void tagallex(const Arg *arg) { + #if SCRATCHPADS_PATCH + tag(&((Arg){.ui = ~SPTAGMASK})); + #else tag(&((Arg){.ui = ~0})); + #endif // SCRATCHPADS_PATCH } int diff --git a/patch/pertag.c b/patch/pertag.c index 2889e0e..3ca7ab2 100644 --- a/patch/pertag.c +++ b/patch/pertag.c @@ -32,7 +32,11 @@ pertagview(const Arg *arg) if (arg->ui & TAGMASK) { selmon->pertag->prevtag = selmon->pertag->curtag; selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; + #if SCRATCHPADS_PATCH + if (arg->ui == ~SPTAGMASK) + #else if (arg->ui == ~0) + #endif // SCRATCHPADS_PATCH selmon->pertag->curtag = 0; else { for (i = 0; !(arg->ui & 1 << i); i++) ;