Adding reorganizetags patch

pull/48/head
bakkeby 4 years ago
parent f067db87aa
commit ed7a43edf1

@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2020-08-02 - Added reorganizetags patch
2020-07-19 - Added barmodules patch - making extrabar, leftlayout, staticstatus and statusallmons patches redundant, added powerline patch
2020-07-18 - **Note**: Up until now building dwm-flexipath without any patches selected would have given you something more or less identical with mainstream dwm. In order to reduce complexity when it comes to maintainance future versions of dwm-flexipatch may diverge from this by making some patches non-optional. For the classic dwm-flexipatch and its many patch integration hints refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0) which will be subject to bug fixes and mainstream dwm updates as far as feasible.
@ -354,6 +356,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [push](https://dwm.suckless.org/patches/push/)
- this patch provides a way to move clients up and down inside the client list
- [reorganizetags](https://dwm.suckless.org/patches/reorganizetags/)
- shifts all clients per tag to leftmost unoccupied tags
- e.g. if clients A, B, C are tagged on tags 1, 5, 9 respectively, when reorganized they will now be on tag 1, 2, and 3
- [resizecorners](https://dwm.suckless.org/patches/resizecorners/)
- by default, windows only resize from the bottom right corner
- with this patch the mouse is warped to the nearest corner and you resize from there

@ -928,6 +928,9 @@ static Key keys[] = {
#if TRANSFER_ALL_PATCH
{ MODKEY|ControlMask, XK_x, transferall, {0} },
#endif // TRANSFER_ALL_PATCH
#if REORGANIZETAGS_PATCH
{ MODKEY|ControlMask, XK_r, reorganizetags, {0} },
#endif // REORGANIZETAGS_PATCH
{ MODKEY, XK_Return, zoom, {0} },
#if VANITYGAPS_PATCH
{ MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } },

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

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

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

@ -572,6 +572,18 @@
*/
#define PUSH_NO_MASTER_PATCH 0
/* Shifts all clients per tag to leftmost unoccupied tags.
*
* For example, if clients A, B, C are tagged on tags 1, 5, 9 respectively, when
* this function is called, they will now be on 1, 2, and 3. The focused client
* will also remain focused.
*
* Clients on multiple tags will be treated as if they only were only on their
* leftmost tag, and will be reduced to one tag after the operation is complete.
* https://dwm.suckless.org/patches/reorganizetags/
*/
#define REORGANIZETAGS_PATCH 0
/* Resets the layout and mfact if there is only one visible client.
* https://dwm.suckless.org/patches/resetlayout/
*/

Loading…
Cancel
Save