summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Rumbaugh <doug@douglasrumbaugh.com>2022-12-02 23:42:18 -0500
committerDouglas Rumbaugh <doug@douglasrumbaugh.com>2022-12-05 15:35:54 -0500
commitda4475e12268ea27869957fa775dddbb539c110a (patch)
tree7ac51762bc946d8ba0e1b3a9ef6648e86be141c5
parent526a0bf71173c42b71a34e5a787fb086a84b3c5c (diff)
downloaddwm-da4475e12268ea27869957fa775dddbb539c110a.tar.gz
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.
-rw-r--r--dwm.c30
1 files 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