modify togglescratch function to dismiss all
This commit is contained in:
parent
d155eb41fb
commit
5a7b533e39
|
@ -49,11 +49,15 @@ typedef struct {
|
||||||
const char *spcmd0[] = {"st", "-n", "spterm0", "-T", "scratchpad (y)", "-g", "150x50", NULL };
|
const char *spcmd0[] = {"st", "-n", "spterm0", "-T", "scratchpad (y)", "-g", "150x50", NULL };
|
||||||
const char *spcmd1[] = {"st", "-n", "spterm1", "-T", "scratchpad (u)", "-g", "150x50", NULL };
|
const char *spcmd1[] = {"st", "-n", "spterm1", "-T", "scratchpad (u)", "-g", "150x50", NULL };
|
||||||
const char *spcmd2[] = {"st", "-n", "spterm2", "-T", "scratchpad (i)", "-g", "150x50", NULL };
|
const char *spcmd2[] = {"st", "-n", "spterm2", "-T", "scratchpad (i)", "-g", "150x50", NULL };
|
||||||
|
const char *spcmd3[] = {"st", "-n", "spterm3", "-T", "color-chooser", "-g", "90x30", "kcolorchooser", NULL };
|
||||||
|
const char *spcmd4[] = {"st", "-n", "spterm4", "-T", "clipboard-view", "-g", "140x50", "dmenu-clipper", NULL };
|
||||||
static Sp scratchpads[] = {
|
static Sp scratchpads[] = {
|
||||||
/* name cmd */
|
/* name cmd */
|
||||||
{"spterm0", spcmd0},
|
{"spterm0", spcmd0},
|
||||||
{"spterm1", spcmd1},
|
{"spterm1", spcmd1},
|
||||||
{"spterm2", spcmd2},
|
{"spterm2", spcmd2},
|
||||||
|
{"spterm3", spcmd3},
|
||||||
|
{"spterm4", spcmd4},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +77,8 @@ static const Rule rules[] = {
|
||||||
{ NULL, "spterm0", NULL, SPTAG(0), 1, 1, 0 -1 },
|
{ NULL, "spterm0", NULL, SPTAG(0), 1, 1, 0 -1 },
|
||||||
{ NULL, "spterm1", NULL, SPTAG(1), 1, 1, 0 -1 },
|
{ NULL, "spterm1", NULL, SPTAG(1), 1, 1, 0 -1 },
|
||||||
{ NULL, "spterm2", NULL, SPTAG(2), 1, 1, 0 -1 },
|
{ NULL, "spterm2", NULL, SPTAG(2), 1, 1, 0 -1 },
|
||||||
|
{ NULL, "spterm3", NULL, SPTAG(3), 1, 1, 0 -1 },
|
||||||
|
{ NULL, "spterm4", NULL, SPTAG(4), 1, 1, 0 -1 },
|
||||||
{ NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
|
{ NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -147,6 +153,9 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XK_y, togglescratch, {.ui = 0 } },
|
{ MODKEY, XK_y, togglescratch, {.ui = 0 } },
|
||||||
{ MODKEY, XK_u, togglescratch, {.ui = 1 } },
|
{ MODKEY, XK_u, togglescratch, {.ui = 1 } },
|
||||||
{ MODKEY, XK_i, togglescratch, {.ui = 2 } },
|
{ MODKEY, XK_i, togglescratch, {.ui = 2 } },
|
||||||
|
{ MODKEY, XK_c, togglescratch, {.ui = 3 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_c, togglescratch, {.ui = 4 } },
|
||||||
|
{ MODKEY, XK_o, togglescratch, {.ui = -1 } },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* button definitions */
|
/* button definitions */
|
||||||
|
|
15
dwm.c
15
dwm.c
|
@ -1918,6 +1918,20 @@ togglescratch(const Arg *arg)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
unsigned int found = 0;
|
unsigned int found = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (arg->ui == -1) { // Hide all visible scratchpads
|
||||||
|
for (i = 0; i < LENGTH(scratchpads); i++) {
|
||||||
|
unsigned int scratchtag = SPTAG(i);
|
||||||
|
for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
|
||||||
|
if (found && ISVISIBLE(c)) { // Only hide if visible
|
||||||
|
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
|
||||||
|
selmon->tagset[selmon->seltags] = newtagset;
|
||||||
|
focus(NULL);
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // Handle individual scratchpads as before
|
||||||
unsigned int scratchtag = SPTAG(arg->ui);
|
unsigned int scratchtag = SPTAG(arg->ui);
|
||||||
Arg sparg = {.v = scratchpads[arg->ui].cmd};
|
Arg sparg = {.v = scratchpads[arg->ui].cmd};
|
||||||
|
|
||||||
|
@ -1938,6 +1952,7 @@ togglescratch(const Arg *arg)
|
||||||
spawn(&sparg);
|
spawn(&sparg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
toggletag(const Arg *arg)
|
toggletag(const Arg *arg)
|
||||||
|
|
Loading…
Reference in New Issue