diff options
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/include.c | 3 | ||||
| -rw-r--r-- | patch/include.h | 3 | ||||
| -rw-r--r-- | patch/swaptags.c | 22 | ||||
| -rw-r--r-- | patch/swaptags.h | 1 |
4 files changed, 29 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c index ef71088..4ed46cd 100644 --- a/patch/include.c +++ b/patch/include.c @@ -113,6 +113,9 @@ #if SWAPFOCUS_PATCH && PERTAG_PATCH #include "swapfocus.c" #endif +#if SWAPTAGS_PATCH +#include "swaptags.c" +#endif #if SWITCHCOL_PATCH #include "switchcol.c" #endif diff --git a/patch/include.h b/patch/include.h index 62ecd46..ba906a5 100644 --- a/patch/include.h +++ b/patch/include.h @@ -113,6 +113,9 @@ #if SWAPFOCUS_PATCH && PERTAG_PATCH #include "swapfocus.h" #endif +#if SWAPTAGS_PATCH +#include "swaptags.h" +#endif #if SWITCHCOL_PATCH #include "switchcol.h" #endif diff --git a/patch/swaptags.c b/patch/swaptags.c new file mode 100644 index 0000000..c43a83f --- /dev/null +++ b/patch/swaptags.c @@ -0,0 +1,22 @@ +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); +}
\ No newline at end of file diff --git a/patch/swaptags.h b/patch/swaptags.h new file mode 100644 index 0000000..150fcce --- /dev/null +++ b/patch/swaptags.h @@ -0,0 +1 @@ +static void swaptags(const Arg *arg);
\ No newline at end of file |
