summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--dwm.c33
-rw-r--r--patches.h15
3 files changed, 53 insertions, 1 deletions
diff --git a/README.md b/README.md
index f73f485..05ba782 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
-2019-10-04 - Added maximize, movestack, monoclesymbol, noborder and tagall patches
+2019-10-04 - Added maximize, movestack, monoclesymbol, noborder, tagall and tagintostack patches
2019-10-03 - Added onlyquitonempty and switchcol patches
@@ -203,6 +203,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [tagallmon](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-tagallmon-6.2.diff)
- move all visible windows to an adjacent monitor
+ - [tagintostack](https://dwm.suckless.org/patches/tagintostack/)
+ - makes new clients attach into the stack area when you toggle a new tag into view
+ - this means your master area will remain unchanged when toggling views
+
- [tagmonfixfs](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-tagmonfixfs-6.2.diff)
- allows moving a fullscreen window to another monitor while remaining in fullscreen
diff --git a/dwm.c b/dwm.c
index 343fa93..11d3c8f 100644
--- a/dwm.c
+++ b/dwm.c
@@ -2751,6 +2751,39 @@ toggleview(const Arg *arg)
int i;
#endif // PERTAG_PATCH
+ #if TAGINTOSTACK_ALLMASTER_PATCH
+ Client *const selected = selmon->sel;
+
+ // clients in the master area should be the same after we add a new tag
+ Client **const masters = calloc(selmon->nmaster, sizeof(Client *));
+ if (!masters) {
+ die("fatal: could not calloc() %u bytes \n", selmon->nmaster * sizeof(Client *));
+ }
+ // collect (from last to first) references to all clients in the master area
+ Client *c;
+ size_t i;
+ for (c = nexttiled(selmon->clients), i = 0; c && i < selmon->nmaster; c = nexttiled(c->next), ++i)
+ masters[selmon->nmaster - (i + 1)] = c;
+ // put the master clients at the front of the list
+ // > go from the 'last' master to the 'first'
+ for (size_t i = 0; i < selmon->nmaster; ++i)
+ if (masters[i])
+ pop(masters[i]);
+ free(masters);
+
+ // we also want to be sure not to mutate the focus
+ focus(selected);
+ #elif TAGINTOSTACK_ONEMASTER_PATCH
+ // the first visible client should be the same after we add a new tag
+ // we also want to be sure not to mutate the focus
+ Client *const c = nexttiled(selmon->clients);
+ if (c) {
+ Client * const selected = selmon->sel;
+ pop(c);
+ focus(selected);
+ }
+ #endif // TAGINTOSTACK_ALLMASTER_PATCH / TAGINTOSTACK_ONEMASTER_PATCH
+
#if !EMPTYVIEW_PATCH
if (newtagset) {
#endif // EMPTYVIEW_PATCH
diff --git a/patches.h b/patches.h
index 17c5d7a..d7a0642 100644
--- a/patches.h
+++ b/patches.h
@@ -326,6 +326,21 @@
*/
#define TAGALLMON_PATCH 0
+/* This patch makes new clients attach into the stack area when you toggle a new tag into
+ * view. This means your master area will remain unchanged when toggling views.
+ * The allmaster patch will cause all clients in the master area to be left alone. This patch
+ * takes precedence over the onemaster tagintostack patch.
+ * https://dwm.suckless.org/patches/tagintostack/
+ */
+#define TAGINTOSTACK_ALLMASTER_PATCH 0
+
+/* This patch makes new clients attach into the stack area when you toggle a new tag into
+ * view. This means your master area will remain unchanged when toggling views.
+ * The onemaster patch will cause the first client in the master area to be left alone.
+ * https://dwm.suckless.org/patches/tagintostack/
+ */
+#define TAGINTOSTACK_ONEMASTER_PATCH 0
+
/* If you try to send a fullscreen window to an adjacent monitor using tagmon then
* the window is moved behind the scenes, but it remains in fullscreen on the original
* monitor until you exit fullscreen view (at which point it will appear on the adjacent