commit 42c4adf6c30bf594cd38e082f31cf52eaec4090a
parent f9184509af04e6f8d979a202aa376def1649f3a8
Author: Natasha Kerensikova <natacha@instinctive.eu>
Date: Sat, 20 May 2023 17:17:16 +0200
[patch] dwm-focusurgent-20221004-6.3.diff
Diffstat:
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -61,6 +61,7 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL };
+#include "focusurgent.c"
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
@@ -97,6 +98,7 @@ static const Key keys[] = {
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
+ { MODKEY, XK_u, focusurgent, {0} },
};
/* button definitions */
diff --git a/focusurgent.c b/focusurgent.c
@@ -0,0 +1,20 @@
+static void
+focusurgent(const Arg *arg) {
+ Monitor *m;
+ Client *c;
+ int i;
+ for(m=mons; m; m=m->next){
+ for(c=m->clients; c && !c->isurgent; c=c->next);
+ if(c) {
+ unfocus(selmon->sel, 0);
+ selmon = m;
+ for(i=0; i < LENGTH(tags) && !((1 << i) & c->tags); i++);
+ if(i < LENGTH(tags)) {
+ const Arg a = {.ui = 1 << i};
+ view(&a);
+ focus(c);
+ warp(c);
+ }
+ }
+ }
+}