diff options
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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[]) { |