mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Upgrading Gaspar Vardanyan's scratchpad patch to the 20200510 version.
https://github.com/GasparVardanyan/dwm-scratchpad/blob/master/dwm-scratchpad-20200510-f09418b.diff
This commit is contained in:
parent
fbb1537da6
commit
bad53d2cc4
@ -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} },
|
||||
|
9
dwm.c
9
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
|
||||
|
@ -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;
|
||||
|
@ -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 ();
|
||||
|
Loading…
Reference in New Issue
Block a user