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