diff options
| author | bakkeby <[email protected]> | 2020-08-02 15:18:18 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-08-02 15:18:18 +0200 |
| commit | ed7a43edf1f682e99d4d9d1796e104b69fb81e1e (patch) | |
| tree | 10a4bef3ad20bcd6bc693dad02841278c5747759 /patch | |
| parent | f067db87aa875f9290ff9328272d053942fe613b (diff) | |
| download | dwm-flexipatch-ed7a43edf1f682e99d4d9d1796e104b69fb81e1e.tar.gz dwm-flexipatch-ed7a43edf1f682e99d4d9d1796e104b69fb81e1e.zip | |
Adding reorganizetags patch
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/include.c | 3 | ||||
| -rw-r--r-- | patch/include.h | 3 | ||||
| -rw-r--r-- | patch/reorganizetags.c | 27 | ||||
| -rw-r--r-- | patch/reorganizetags.h | 1 |
4 files changed, 34 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c index 2964b98..9e008b9 100644 --- a/patch/include.c +++ b/patch/include.c @@ -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 diff --git a/patch/include.h b/patch/include.h index b3bce6f..245933e 100644 --- a/patch/include.h +++ b/patch/include.h @@ -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 diff --git a/patch/reorganizetags.c b/patch/reorganizetags.c new file mode 100644 index 0000000..3c0211d --- /dev/null +++ b/patch/reorganizetags.c @@ -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); +}
\ No newline at end of file diff --git a/patch/reorganizetags.h b/patch/reorganizetags.h new file mode 100644 index 0000000..27c0cea --- /dev/null +++ b/patch/reorganizetags.h @@ -0,0 +1 @@ +static void reorganizetags(const Arg *arg);
\ No newline at end of file |
