From f2558593e41a462b7137954c1b27d79fa42851aa Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 10 May 2025 19:26:13 +0530 Subject: patched dwm-swaptags-6.2.diff --- dwm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index 4acfec7..56784ff 100644 --- a/dwm.c +++ b/dwm.c @@ -235,6 +235,7 @@ static int xerror(Display *dpy, XErrorEvent *ee); static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); +static void swaptags(const Arg *arg); /* variables */ static const char broken[] = "broken"; @@ -2153,6 +2154,28 @@ zoom(const Arg *arg) pop(c); } +void +swaptags(const Arg *arg) +{ + unsigned int newtag = arg->ui & TAGMASK; + unsigned int curtag = selmon->tagset[selmon->seltags]; + + 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(!c->tags) c->tags = newtag; + } + + selmon->tagset[selmon->seltags] = newtag; + + focus(NULL); + arrange(selmon); +} + int main(int argc, char *argv[]) { -- cgit v1.2.3