Adding reorganizetags patch
This commit is contained in:
@ -137,6 +137,9 @@
|
||||
#elif PUSH_PATCH
|
||||
#include "push.c"
|
||||
#endif
|
||||
#if REORGANIZETAGS_PATCH
|
||||
#include "reorganizetags.c"
|
||||
#endif
|
||||
#if RESTARTSIG_PATCH
|
||||
#include "restartsig.c"
|
||||
#endif
|
||||
|
@ -137,6 +137,9 @@
|
||||
#elif PUSH_PATCH
|
||||
#include "push.h"
|
||||
#endif
|
||||
#if REORGANIZETAGS_PATCH
|
||||
#include "reorganizetags.h"
|
||||
#endif
|
||||
#if RESTARTSIG_PATCH
|
||||
#include "restartsig.h"
|
||||
#endif
|
||||
|
27
patch/reorganizetags.c
Normal file
27
patch/reorganizetags.c
Normal file
@ -0,0 +1,27 @@
|
||||
void
|
||||
reorganizetags(const Arg *arg)
|
||||
{
|
||||
Client *c;
|
||||
unsigned int occ, unocc, i;
|
||||
unsigned int tagdest[LENGTH(tags)];
|
||||
|
||||
occ = 0;
|
||||
for (c = selmon->clients; c; c = c->next)
|
||||
occ |= (1 << (ffs(c->tags)-1));
|
||||
unocc = 0;
|
||||
for (i = 0; i < LENGTH(tags); ++i) {
|
||||
while (unocc < i && (occ & (1 << unocc)))
|
||||
unocc++;
|
||||
if (occ & (1 << i)) {
|
||||
tagdest[i] = unocc;
|
||||
occ &= ~(1 << i);
|
||||
occ |= 1 << unocc;
|
||||
}
|
||||
}
|
||||
|
||||
for (c = selmon->clients; c; c = c->next)
|
||||
c->tags = 1 << tagdest[ffs(c->tags)-1];
|
||||
if (selmon->sel)
|
||||
selmon->tagset[selmon->seltags] = selmon->sel->tags;
|
||||
arrange(selmon);
|
||||
}
|
1
patch/reorganizetags.h
Normal file
1
patch/reorganizetags.h
Normal file
@ -0,0 +1 @@
|
||||
static void reorganizetags(const Arg *arg);
|
Reference in New Issue
Block a user