summaryrefslogtreecommitdiffhomepage
path: root/patch/swaptags.c
diff options
context:
space:
mode:
authorBagellll <[email protected]>2022-02-11 10:57:53 -0500
committerGitHub <[email protected]>2022-02-11 16:57:53 +0100
commitae67378b200842998bb4bc178e0d67220f09fefc (patch)
tree9da48cb032d37b646a0b93d954fe5b7942f9cf96 /patch/swaptags.c
parent8f986a4e3b64533d9d96272941685a314f3fa837 (diff)
downloaddwm-flexipatch-ae67378b200842998bb4bc178e0d67220f09fefc.tar.gz
dwm-flexipatch-ae67378b200842998bb4bc178e0d67220f09fefc.zip
Tag-Sync patch (for syncing tags across all monitors) (#219)
* Tag-Sync patch * Major compatibility updates * SWITCHTAG/TAGSYNC compatibility * tagsync: refactoring Co-authored-by: bakkeby <[email protected]>
Diffstat (limited to 'patch/swaptags.c')
-rw-r--r--patch/swaptags.c34
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 }));
}