From ed1654712aed232afea3606e98aff0464ecc25bc Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Fri, 29 Aug 2025 08:43:38 +0800 Subject: [PATCH] feat: view same tag auto back prev tag --- src/dispatch/bind_define.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index f39543f..dfd23d6 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -1,8 +1,26 @@ void bind_to_view(const Arg *arg) { - if ((int)arg->ui == INT_MIN) { + + unsigned int target = arg->ui; + + if (selmon->pertag->curtag && + target == (1 << (selmon->pertag->curtag - 1))) { + if (selmon->pertag->prevtag) + target = 1 << (selmon->pertag->prevtag - 1); + else + target = 0; + } + + if ((int)target == INT_MIN && selmon->pertag->curtag == 0) { + if (selmon->pertag->prevtag) + target = 1 << (selmon->pertag->prevtag - 1); + else + target = 0; + } + + if (target == 0 || (int)target == INT_MIN) { view(&(Arg){.ui = ~0}, false); } else { - view(arg, true); + view(&(Arg){.ui = target}, true); } }