opt: fix tagsel toggle

This commit is contained in:
DreamMaoMao 2025-08-29 18:49:01 +08:00
parent 04f1d97733
commit 1f77e58baf
2 changed files with 16 additions and 5 deletions

View file

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

View file

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