From ab2c5fe5dace1007ec8423655319a706f881baae Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 26 Nov 2019 20:23:58 +0100 Subject: [PATCH] Adding switchtag improvements --- README.md | 2 +- dwm.c | 12 ++++++++++++ patches.h | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e46fa04..7e2bc03 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2019-11-26 - Added dmenumatchtop patch +2019-11-26 - Added dmenumatchtop patch, added improvements to the switchtag patch based on ideas from the switchtotag patch 2019-11-21 - Added fakefullscreenclient patch diff --git a/dwm.c b/dwm.c index 468f5dc..d1fe9bb 100644 --- a/dwm.c +++ b/dwm.c @@ -149,6 +149,9 @@ struct Client { int basew, baseh, incw, inch, maxw, maxh, minw, minh; int bw, oldbw; unsigned int tags; + #if SWITCHTAG_PATCH + unsigned int switchtag; + #endif // SWITCHTAG_PATCH int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; #if FAKEFULLSCREEN_CLIENT_PATCH int fakefullscreen; @@ -526,9 +529,14 @@ applyrules(Client *c) newtagset = c->tags; if (newtagset) { + c->switchtag = selmon->tagset[selmon->seltags]; c->mon->tagset[c->mon->seltags] = newtagset; if (r->switchtag == 1) + #if PERTAG_PATCH pertagview(&((Arg) { .ui = newtagset })); + #else + view(&((Arg) { .ui = newtagset })); + #endif // PERTAG_PATCH arrange(c->mon); } } @@ -3316,6 +3324,10 @@ unmanage(Client *c, int destroyed) focus(NULL); updateclientlist(); arrange(m); + #if SWITCHTAG_PATCH + if (c->switchtag) + view(&((Arg) { .ui = c->switchtag })); + #endif // SWITCHTAG_PATCH } void diff --git a/patches.h b/patches.h index 734832e..fdf770e 100644 --- a/patches.h +++ b/patches.h @@ -439,7 +439,10 @@ * 1 automatically moves you to the tag of the newly opened application and * 2 enables the tag of the newly opened application in addition to your existing enabled tags * + * Closing that window reverts the view back to what it was before the window was opened. + * * https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-switchtag-6.2.diff + * Also see https://dwm.suckless.org/patches/switchtotag */ #define SWITCHTAG_PATCH 0