aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAcid Bong <acid-bong@cock.lt>2022-10-19 13:23:34 +0300
committerAcid Bong <acid-bong@cock.lt>2022-10-19 13:23:34 +0300
commite9c46c8624e3de1fba021c30bbc42707ef51353c (patch)
tree90e073717f805c2959e99c5f474cd0fed83cd167
parentabd174196e98af390857d3bbc924a3cfac6f27d9 (diff)
downloaddwm-e9c46c8624e3de1fba021c30bbc42707ef51353c.tar.gz
patch: focusurgent
-rw-r--r--config.def.h3
-rw-r--r--focusurgent.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h
index b8f0908..1de3c06 100644
--- a/config.def.h
+++ b/config.def.h
@@ -59,6 +59,7 @@ static const char *termcmd[] = { "st", NULL };
#include <X11/XF86keysym.h>
#include "movestack.c"
+#include "focusurgent.c"
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_space, spawn, {.v = dmenucmd } },
@@ -124,6 +125,8 @@ static const Key keys[] = {
{ MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } },
{ MODKEY|ShiftMask, XK_Down, movestack, {.i = +1 } }, /* arrow keys */
{ MODKEY|ShiftMask, XK_Up, movestack, {.i = -1 } },
+ /* focusurgent patch */
+ { MODKEY, XK_a, focusurgent, {0} },
};
/* button definitions */
diff --git a/focusurgent.c b/focusurgent.c
new file mode 100644
index 0000000..bc6eee6
--- /dev/null
+++ b/focusurgent.c
@@ -0,0 +1,14 @@
+static void
+focusurgent(const Arg *arg) {
+ Client *c;
+ int i;
+ for(c=selmon->clients; c && !c->isurgent; c=c->next);
+ if(c) {
+ 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);
+ }
+ }
+}