diff options
Diffstat (limited to 'patch/swaptags.c')
| -rw-r--r-- | patch/swaptags.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/patch/swaptags.c b/patch/swaptags.c index d6a72d7..7e1e920 100644 --- a/patch/swaptags.c +++ b/patch/swaptags.c @@ -1,23 +1,31 @@ void swaptags(const Arg *arg) { - unsigned int newtag = arg->ui & TAGMASK; - unsigned int curtag = selmon->tagset[selmon->seltags]; + Client *c; + unsigned int newtag = arg->ui & TAGMASK; + unsigned int curtag = selmon->tagset[selmon->seltags]; - if (newtag == curtag || !curtag || (curtag & (curtag-1))) - return; + if (newtag == curtag || !curtag || (curtag & (curtag-1))) + return; - for (Client *c = selmon->clients; c != NULL; c = c->next) { - if ((c->tags & newtag) || (c->tags & curtag)) - c->tags ^= curtag ^ newtag; + #if TAGSYNC_PATCH + Monitor *origselmon = selmon; + for (selmon = mons; selmon; selmon = selmon->next) { + #endif // TAGSYNC_PATCH - if (!c->tags) - c->tags = newtag; - } + for (c = selmon->clients; c != NULL; c = c->next) { + if ((c->tags & newtag) || (c->tags & curtag)) + c->tags ^= curtag ^ newtag; - selmon->tagset[selmon->seltags] = newtag; + if (!c->tags) + c->tags = newtag; + } - focus(NULL); - arrange(selmon); + #if TAGSYNC_PATCH + } + selmon = origselmon; + #endif // TAGSYNC_PATCH + + view(&((Arg) { .ui = newtag })); } |
