dwm-flexipatch/patch/combo.c

45 lines
751 B
C
Raw Normal View History

2019-09-11 21:35:43 +00:00
static int combo = 0;
#if !HOLDBAR_PATCH
2019-09-11 21:35:43 +00:00
void
keyrelease(XEvent *e)
{
2019-09-11 21:35:43 +00:00
combo = 0;
}
#endif // !HOLDBAR_PATCH
2019-09-11 21:35:43 +00:00
void
combotag(const Arg *arg)
{
if (selmon->sel && arg->ui & TAGMASK) {
2019-09-11 21:35:43 +00:00
if (combo) {
selmon->sel->tags |= arg->ui & TAGMASK;
} else {
combo = 1;
selmon->sel->tags = arg->ui & TAGMASK;
}
focus(NULL);
arrange(selmon);
}
}
void
comboview(const Arg *arg)
{
2019-09-11 21:35:43 +00:00
unsigned newtags = arg->ui & TAGMASK;
if (combo) {
selmon->tagset[selmon->seltags] |= newtags;
} else {
selmon->seltags ^= 1; /*toggle tagset*/
combo = 1;
if (newtags) {
#if PERTAG_PATCH
pertagview(&((Arg) { .ui = newtags }));
#else
2019-09-11 21:35:43 +00:00
selmon->tagset[selmon->seltags] = newtags;
#endif // PERTAG_PATCH
}
2019-09-11 21:35:43 +00:00
}
focus(NULL);
arrange(selmon);
}