[dwm][patch] swapfocus just focus next client after tag or toggletag

This commit is contained in:
bakkeby 2020-01-30 08:43:00 +01:00
parent d644c89c74
commit 8f53248a0f

15
dwm.c
View File

@ -3100,11 +3100,18 @@ spawn(const Arg *arg)
void void
tag(const Arg *arg) tag(const Arg *arg)
{ {
#if SWAPFOCUS_PATCH && PERTAG_PATCH
unsigned int tagmask, tagindex;
#endif // SWAPFOCUS_PATCH
if (selmon->sel && arg->ui & TAGMASK) { if (selmon->sel && arg->ui & TAGMASK) {
selmon->sel->tags = arg->ui & TAGMASK; selmon->sel->tags = arg->ui & TAGMASK;
focus(NULL); focus(NULL);
#if SWAPFOCUS_PATCH && PERTAG_PATCH #if SWAPFOCUS_PATCH && PERTAG_PATCH
selmon->pertag->prevclient[selmon->pertag->curtag] = NULL; selmon->pertag->prevclient[selmon->pertag->curtag] = NULL;
for (tagmask = arg->ui & TAGMASK, tagindex = 1; tagmask!=0; tagmask >>= 1, tagindex++)
if (tagmask & 1)
selmon->pertag->prevclient[tagindex] = NULL;
#endif // SWAPFOCUS_PATCH #endif // SWAPFOCUS_PATCH
arrange(selmon); arrange(selmon);
#if VIEWONTAG_PATCH #if VIEWONTAG_PATCH
@ -3218,6 +3225,9 @@ void
toggletag(const Arg *arg) toggletag(const Arg *arg)
{ {
unsigned int newtags; unsigned int newtags;
#if SWAPFOCUS_PATCH && PERTAG_PATCH
unsigned int tagmask, tagindex;
#endif // SWAPFOCUS_PATCH
if (!selmon->sel) if (!selmon->sel)
return; return;
@ -3225,6 +3235,11 @@ toggletag(const Arg *arg)
if (newtags) { if (newtags) {
selmon->sel->tags = newtags; selmon->sel->tags = newtags;
focus(NULL); focus(NULL);
#if SWAPFOCUS_PATCH && PERTAG_PATCH
for (tagmask = arg->ui & TAGMASK, tagindex = 1; tagmask!=0; tagmask >>= 1, tagindex++)
if (tagmask & 1)
selmon->pertag->prevclient[tagindex] = NULL;
#endif // SWAPFOCUS_PATCH
arrange(selmon); arrange(selmon);
} }
#if EWMHTAGS_PATCH #if EWMHTAGS_PATCH