dwm-6.1-tagintostack-allmaster.diff (1138B)
1 diff --git a/dwm.c b/dwm.c 2 index 1bbb4b3..c4e2f0c 100644 3 --- a/dwm.c 4 +++ b/dwm.c 5 @@ -1663,6 +1663,27 @@ toggletag(const Arg *arg) { 6 void 7 toggleview(const Arg *arg) { 8 unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); 9 + Client *const selected = selmon->sel; 10 + 11 + // clients in the master area should be the same after we add a new tag 12 + Client **const masters = calloc(selmon->nmaster, sizeof(Client *)); 13 + if (!masters) { 14 + die("fatal: could not calloc() %u bytes \n", selmon->nmaster * sizeof(Client *)); 15 + } 16 + // collect (from last to first) references to all clients in the master area 17 + Client *c; 18 + size_t i; 19 + for (c = nexttiled(selmon->clients), i = 0; c && i < selmon->nmaster; c = nexttiled(c->next), ++i) 20 + masters[selmon->nmaster - (i + 1)] = c; 21 + // put the master clients at the front of the list 22 + // > go from the 'last' master to the 'first' 23 + for (size_t i = 0; i < selmon->nmaster; ++i) 24 + if (masters[i]) 25 + pop(masters[i]); 26 + free(masters); 27 + 28 + // we also want to be sure not to mutate the focus 29 + focus(selected); 30 31 if(newtagset) { 32 selmon->tagset[selmon->seltags] = newtagset;