[wiki] [sites] [dwm][patch][switchtotag] Added dwm patch switchtotag || rid9
commit 87951c9e30005901061e1fc738585e55c1b84369
Author: rid9 <rid99_AT_protonmail.com>
Date: Mon Nov 18 18:56:38 2019 +0200
[dwm][patch][switchtotag] Added dwm patch switchtotag
diff --git a/dwm.suckless.org/patches/switchtotag/dwm-switchtotag-6.2.diff b/dwm.suckless.org/patches/switchtotag/dwm-switchtotag-6.2.diff
new file mode 100644
index 00000000..453f8ef6
--- /dev/null
+++ b/dwm.suckless.org/patches/switchtotag/dwm-switchtotag-6.2.diff
_AT_@ -0,0 +1,58 @@
+diff -up dwm-6.2-original/config.def.h dwm-6.2-modified/config.def.h
+--- dwm-6.2-original/config.def.h 2019-02-02 14:55:28.000000000 +0200
++++ dwm-6.2-modified/config.def.h 2019-11-18 19:36:22.515566509 +0200
+_AT_@ -26,9 +26,9 @@ static const Rule rules[] = {
+ * WM_CLASS(STRING) = instance, class
+ * WM_NAME(STRING) = title
+ */
+- /* class instance title tags mask isfloating monitor */
+- { "Gimp", NULL, NULL, 0, 1, -1 },
+- { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
++ /* class instance title tags mask switchtotag isfloating monitor */
++ { "Gimp", NULL, NULL, 0, 0, 1, -1 },
++ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
+ };
+
+ /* layout(s) */
+diff -up dwm-6.2-original/dwm.c dwm-6.2-modified/dwm.c
+--- dwm-6.2-original/dwm.c 2019-02-02 14:55:28.000000000 +0200
++++ dwm-6.2-modified/dwm.c 2019-11-18 19:37:18.792187705 +0200
+_AT_@ -92,6 +92,7 @@ struct Client {
+ int basew, baseh, incw, inch, maxw, maxh, minw, minh;
+ int bw, oldbw;
+ unsigned int tags;
++ unsigned int switchtotag;
+ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
+ Client *next;
+ Client *snext;
+_AT_@ -137,6 +138,7 @@ typedef struct {
+ const char *instance;
+ const char *title;
+ unsigned int tags;
++ unsigned int switchtotag;
+ int isfloating;
+ int monitor;
+ } Rule;
+_AT_@ -302,6 +304,11 @@ applyrules(Client *c)
+ for (m = mons; m && m->num != r->monitor; m = m->next);
+ if (m)
+ c->mon = m;
++ if (r->switchtotag) {
++ Arg a = { .ui = r->tags };
++ c->switchtotag = selmon->tagset[selmon->seltags];
++ view(&a);
++ }
+ }
+ }
+ if (ch.res_class)
+_AT_@ -1782,6 +1789,10 @@ unmanage(Client *c, int destroyed)
+ focus(NULL);
+ updateclientlist();
+ arrange(m);
++ if (c->switchtotag) {
++ Arg a = { .ui = c->switchtotag };
++ view(&a);
++ }
+ }
+
+ void
diff --git a/dwm.suckless.org/patches/switchtotag/index.md b/dwm.suckless.org/patches/switchtotag/index.md
new file mode 100644
index 00000000..01d56871
--- /dev/null
+++ b/dwm.suckless.org/patches/switchtotag/index.md
_AT_@ -0,0 +1,32 @@
+switchtotag
+===========
+
+Description
+-----------
+Adds a rule option to switch to the configured tag when a window opens, then
+switch back when it closes.
+
+The patch modifies `config.def.h`. Make sure to update `config.h` accordingly,
+if the file exists.
+
+Example Configuration
+---------------------
+
+ static const Rule rules[] = {
+ /* class instance title tags mask switchtotag isfloating monitor */
+ { "Gimp", NULL, NULL, 0, 0, 1, -1 },
+ { "Firefox", NULL, NULL, 1 << 8, 1, 0, -1 },
+ };
+
+In this example, since Firefox is configured to start with tag 9 and switchtotag
+is enabled, as soon as the application starts, dwm will switch to tag 9. When
+Firefox closes, dwm will switch back to the tags which were active before the
+application started.
+
+Download
+--------
+* [dwm-switchtotag-6.2.diff](dwm-switchtotag-6.2.diff)
+
+Author
+------
+* rid9 <rid99_AT_protonmail.com>
Received on Mon Nov 18 2019 - 18:42:59 CET
This archive was generated by hypermail 2.3.0
: Mon Nov 18 2019 - 18:48:31 CET