diff -up dwm/config.def.h dwmmod/config.def.h --- dwm/config.def.h 2020-09-20 21:07:45.689633732 -0300 +++ dwmmod/config.def.h 2020-09-20 21:10:21.823645209 -0300 @@ -49,7 +49,7 @@ static const Layout layouts[] = { { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + { MODKEY|ControlMask|ShiftMask, KEY, tagunfocused, {.ui = 1 << TAG} }, /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } diff -up dwm/dwm.c dwmmod/dwm.c --- dwm/dwm.c 2020-09-20 21:07:45.690633732 -0300 +++ dwmmod/dwm.c 2020-09-20 21:09:54.463643197 -0300 @@ -208,6 +208,7 @@ static void showhide(Client *c); static void sigchld(int unused); static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); +static void tagunfocused(const Arg *arg); static void tile(Monitor *); static void togglebar(const Arg *arg); @@ -1664,6 +1665,29 @@ tag(const Arg *arg) } void +tagunfocused(const Arg *arg) +{ + Client *c = NULL; + int n; + Client *nbc; + + for (n = 0, nbc = nexttiled(selmon->clients); nbc; nbc = nexttiled(nbc->next), n++); + + if (!selmon->sel) + return; + for (int i = 0; i < n; i++) { + for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next); + if (!c) + for (c = selmon->clients; c && !ISVISIBLE(c); c = c->next); + if (c && !(c == selmon->sel)) { + c->tags = arg->ui & TAGMASK; + focus(NULL); + } + } + arrange(selmon); +} + +void tagmon(const Arg *arg) { if (!selmon->sel || !mons->next)