You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dwm-flexipatch/patch/reorganizetags.c

29 lines
661 B
C

void
reorganizetags(const Arg *arg)
{
Client *c;
unsigned int occ, unocc, i;
unsigned int tagdest[NUMTAGS];
occ = 0;
for (c = selmon->clients; c; c = c->next)
occ |= (1 << (ffs(c->tags)-1));
unocc = 0;
for (i = 0; i < NUMTAGS; ++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);
}