summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-09-05 09:11:12 +0200
committerbakkeby <[email protected]>2020-09-05 09:11:12 +0200
commitdcf7b049bade7767f9a7c726ae445c86cedcd291 (patch)
treedf7d421c5f08ff84c704320ee93cfb10319cbfc5
parent69277ea1a863463399fe9e50bb9228255e816244 (diff)
downloaddwm-flexipatch-dcf7b049bade7767f9a7c726ae445c86cedcd291.tar.gz
dwm-flexipatch-dcf7b049bade7767f9a7c726ae445c86cedcd291.zip
Adding view same tag gives previous tag patch
-rw-r--r--dwm.c14
-rw-r--r--patch/focusurgent.c8
-rw-r--r--patches.def.h8
3 files changed, 22 insertions, 8 deletions
diff --git a/dwm.c b/dwm.c
index df6319c..a1deebf 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1146,9 +1146,9 @@ clientmessage(XEvent *e)
} else {
for (i = 0; i < NUMTAGS && !((1 << i) & c->tags); i++);
if (i < NUMTAGS) {
- const Arg a = {.ui = 1 << i};
selmon = c->mon;
- view(&a);
+ if (((1 << i) & TAGMASK) != selmon->tagset[selmon->seltags])
+ view(&((Arg) { .ui = 1 << i }));
focus(c);
restack(selmon);
}
@@ -3281,7 +3281,8 @@ tag(const Arg *arg)
#endif // SWAPFOCUS_PATCH
arrange(selmon);
#if VIEWONTAG_PATCH
- view(arg);
+ if ((arg->ui & TAGMASK) != selmon->tagset[selmon->seltags])
+ view(arg);
#endif // VIEWONTAG_PATCH
}
}
@@ -3562,7 +3563,7 @@ unmanage(Client *c, int destroyed)
updateclientlist();
arrange(m);
#if SWITCHTAG_PATCH
- if (switchtag)
+ if (switchtag && ((switchtag & TAGMASK) != selmon->tagset[selmon->seltags]))
view(&((Arg) { .ui = switchtag }));
#endif // SWITCHTAG_PATCH
}
@@ -3928,7 +3929,12 @@ view(const Arg *arg)
#else
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
#endif // EMPTYVIEW_PATCH
+ {
+ #if VIEW_SAME_TAG_GIVES_PREVIOUS_TAG_PATCH
+ view(&((Arg) { .ui = 0 }));
+ #endif // VIEW_SAME_TAG_GIVES_PREVIOUS_TAG_PATCH
return;
+ }
selmon->seltags ^= 1; /* toggle sel tagset */
#if PERTAG_PATCH
pertagview(arg);
diff --git a/patch/focusurgent.c b/patch/focusurgent.c
index cebb5a3..74946ce 100644
--- a/patch/focusurgent.c
+++ b/patch/focusurgent.c
@@ -3,12 +3,12 @@ focusurgent(const Arg *arg)
{
Client *c;
int i;
- for (c=selmon->clients; c && !c->isurgent; c=c->next);
+ for (c = selmon->clients; c && !c->isurgent; c = c->next);
if (c) {
- for (i=0; i < NUMTAGS && !((1 << i) & c->tags); i++);
+ for (i = 0; i < NUMTAGS && !((1 << i) & c->tags); i++);
if (i < NUMTAGS) {
- const Arg a = {.ui = 1 << i};
- view(&a);
+ if (((1 << i) & TAGMASK) != selmon->tagset[selmon->seltags])
+ view(&((Arg) { .ui = 1 << i }));
focus(c);
}
}
diff --git a/patches.def.h b/patches.def.h
index 91bb480..61c8c34 100644
--- a/patches.def.h
+++ b/patches.def.h
@@ -936,6 +936,14 @@
*/
#define VIEWONTAG_PATCH 0
+/* By default tags can be changed using MOD+<num> while MOD+Tab toggles between the current and
+ * the previous tag. This patch changes this so that if you hit MOD+<num> for the tag you are
+ * currently on, then it works the same as MOD+Tab and switches back to the previous tag.
+ * Idea ref.
+ * https://www.reddit.com/r/suckless/comments/ik27vd/key_toggle_between_next_and_previous_tag_dwm/
+ */
+#define VIEW_SAME_TAG_GIVES_PREVIOUS_TAG_PATCH 0
+
/* This patch warps the mouse cursor to the center of the currently focused window or screen
* when the mouse cursor is (a) on a different screen or (b) on top of a different window.
* https://dwm.suckless.org/patches/warp/