Adding swaptags patch

This commit is contained in:
bakkeby
2020-02-11 08:27:00 +01:00
parent 8cb609fa1e
commit 90a848d608
7 changed files with 44 additions and 2 deletions

View File

@ -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

View File

@ -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

22
patch/swaptags.c Normal file
View File

@ -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);
}

1
patch/swaptags.h Normal file
View File

@ -0,0 +1 @@
static void swaptags(const Arg *arg);