From da4475e12268ea27869957fa775dddbb539c110a Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Fri, 2 Dec 2022 23:42:18 -0500 Subject: dwm.c: fixed a bug in tag-0 handling I admit, this solution is a bit kludgey. But it does appear to do the job. I'll tinker more with it later. --- dwm.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/dwm.c b/dwm.c index 694c772..99bccef 100644 --- a/dwm.c +++ b/dwm.c @@ -2448,26 +2448,31 @@ view(const Arg *arg) int i; unsigned int tmptag; + static int x = 1; + if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) return; - if (selmon->pertag->curtag == 0 && arg->ui != 0) { - Monitor *oldmon = selmon; + if (selmon->pertag->curtag == 0 && x) { + x = 0; for (Monitor *m = mons; m; m = m->next) { - if (m != oldmon) { - selmon = m; - Arg tmp = {0}; - view(&tmp); + Arg marg = {.i = 1}; + focusmon(&marg); + + Arg tmp; + if (selmon->pertag->prevtag == 0) { + tmp.ui = ~0; + } else { + tmp.ui = 1 << (selmon->pertag->prevtag - 1); } + view(&tmp); } - - selmon = oldmon; + x = 1; } selmon->seltags ^= 1; /* toggle sel tagset */ if (arg->ui & TAGMASK) { - if (arg->ui == ~0) { view_t0(arg); } @@ -2499,9 +2504,10 @@ view(const Arg *arg) void view_t0(const Arg *arg) { - Monitor *oldmon = selmon; for (Monitor *m = mons; m; m = m->next) { - selmon = m; + Arg marg = {.i = 1}; + focusmon(&marg); + selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; selmon->pertag->prevtag = selmon->pertag->curtag; selmon->pertag->curtag = 0; @@ -2512,8 +2518,6 @@ view_t0(const Arg *arg) tmp.v = &layouts[7]; setlayout(&tmp); } - - selmon = oldmon; } pid_t -- cgit v1.2.3