sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 87951c9e30005901061e1fc738585e55c1b84369
parent 4e4b259acf30ace5c44d613b7137d87572d4685f
Author: rid9 <rid99@protonmail.com>
Date:   Mon, 18 Nov 2019 18:56:38 +0200

[dwm][patch][switchtotag] Added dwm patch switchtotag

Diffstat:
Adwm.suckless.org/patches/switchtotag/dwm-switchtotag-6.2.diff | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/switchtotag/index.md | 32++++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/switchtotag/dwm-switchtotag-6.2.diff b/dwm.suckless.org/patches/switchtotag/dwm-switchtotag-6.2.diff @@ -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 +@@ -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 +@@ -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; +@@ -137,6 +138,7 @@ typedef struct { + const char *instance; + const char *title; + unsigned int tags; ++ unsigned int switchtotag; + int isfloating; + int monitor; + } Rule; +@@ -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) +@@ -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 @@ -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@protonmail.com>