commit 93eda1cc7aff3c8d11a74cd7a7e78d56bead0e10
parent 7e2932bb06d7de4c7e1d3cc362f15bbbe108476a
Author: burrows <burrows.labs@gmail.com>
Date: Thu, 6 Mar 2014 08:01:38 -0500
added markdown and patches for leaving the master area unchanged when doing a 'toggleview'
Diffstat:
3 files changed, 73 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/dwm-6.1-tagintostack-allmaster.diff b/dwm.suckless.org/patches/dwm-6.1-tagintostack-allmaster.diff
@@ -0,0 +1,32 @@
+diff --git a/dwm.c b/dwm.c
+index 1bbb4b3..c4e2f0c 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -1663,6 +1663,27 @@ toggletag(const Arg *arg) {
+ void
+ toggleview(const Arg *arg) {
+ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
++ 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);
+
+ if(newtagset) {
+ selmon->tagset[selmon->seltags] = newtagset;
diff --git a/dwm.suckless.org/patches/dwm-6.1-tagintostack-onemaster.diff b/dwm.suckless.org/patches/dwm-6.1-tagintostack-onemaster.diff
@@ -0,0 +1,20 @@
+diff --git a/dwm.c b/dwm.c
+index 1bbb4b3..6dfad66 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -1664,6 +1664,15 @@ void
+ toggleview(const Arg *arg) {
+ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
+
++ // 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);
++ }
++
+ if(newtagset) {
+ selmon->tagset[selmon->seltags] = newtagset;
+ focus(NULL);
diff --git a/dwm.suckless.org/patches/tagintostack.md b/dwm.suckless.org/patches/tagintostack.md
@@ -0,0 +1,21 @@
+tagintostack
+===============
+
+Description
+-----------
+`tagintostack` 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
+* the `onemaster` patch will cause the first client in the master area to be left
+alone (this is a much simpler piece of code)
+
+Download
+--------
+* [dwm-6.1-tagintostack-allmaster.diff](dwm-6.1-tagintostack-allmaster.diff) (568b) (20140306)
+* [dwm-6.1-tagintostack-onemaster.diff](dwm-6.1-tagintostack-onemaster.diff) (1138b) (20140306)
+
+Author
+------
+* Aaron Burrow - <burrows.labs@gmail.com>