From 1f77e58baf2fce0818bf6d71223a63723a1a8aae Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Fri, 29 Aug 2025 18:49:01 +0800 Subject: [PATCH] opt: fix tagsel toggle --- src/dispatch/bind_define.h | 2 +- src/mango.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index dfd23d6..582219b 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -18,7 +18,7 @@ void bind_to_view(const Arg *arg) { } if (target == 0 || (int)target == INT_MIN) { - view(&(Arg){.ui = ~0}, false); + view(&(Arg){.ui = ~0 & TAGMASK}, false); } else { view(&(Arg){.ui = target}, true); } diff --git a/src/mango.c b/src/mango.c index d6c277c..e91cfbd 100644 --- a/src/mango.c +++ b/src/mango.c @@ -4844,7 +4844,7 @@ void toggleoverview(const Arg *arg) { visible_client_number++; } if (visible_client_number > 0) { - target = ~0; + target = ~0 & TAGMASK; } else { selmon->isoverview ^= 1; return; @@ -5165,23 +5165,32 @@ urgent(struct wl_listener *listener, void *data) { void view_in_mon(const Arg *arg, bool want_animation, Monitor *m) { unsigned int i, tmptag; - if (!m || (arg->ui != ~0 && m->isoverview)) { + if (!m || (arg->ui != (~0 & TAGMASK) && m->isoverview)) { return; } - if (arg->ui == 0) + if (arg->ui == 0) { return; + } + + if (arg->ui == UINT32_MAX) { + m->pertag->prevtag = m->tagset[m->seltags]; + m->seltags ^= 1; /* toggle sel tagset */ + m->pertag->curtag = m->tagset[m->seltags]; + goto toggleseltags; + } if ((m->tagset[m->seltags] & arg->ui & TAGMASK) != 0) { want_animation = false; } m->seltags ^= 1; /* toggle sel tagset */ + if (arg->ui & TAGMASK) { m->tagset[m->seltags] = arg->ui & TAGMASK; tmptag = m->pertag->curtag; - if (arg->ui == ~0) + if (arg->ui == (~0 & TAGMASK)) m->pertag->curtag = 0; else { for (i = 0; !(arg->ui & 1 << i) && i < LENGTH(tags) && arg->ui != 0; @@ -5198,6 +5207,8 @@ void view_in_mon(const Arg *arg, bool want_animation, Monitor *m) { m->pertag->curtag = tmptag; } +toggleseltags: + focusclient(focustop(m), 1); arrange(m, want_animation); printstatus();