dwm

dynamic window manager
git clone https://git.parazyd.org/dwm
Log | Files | Refs | README | LICENSE

commit 5d724733483b327aa3173a59022b751b38085909
parent ab128d39306091645ffa318cd8baab08d1128bd8
Author: parazyd <parazyd@dyne.org>
Date:   Sun, 24 Apr 2022 11:56:57 +0200

focusurgent

Diffstat:
Mconfig.def.h | 2++
Mconfig.h | 2++
Afocusurgent.c | 15+++++++++++++++
3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -68,6 +68,7 @@ static const char *termcmd[] = { "st", NULL }; static const char scratchpadname[] = "scratchpad"; static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL }; +#include "focusurgent.c" #include "movestack.c" static const Key keys[] = { @@ -109,6 +110,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/config.h b/config.h @@ -81,6 +81,7 @@ static const char *glyphcmd[] = { "glyph", NULL }; static const char *rickcmd[] = { "mpv", "--no-video", "never_gonna_give_you_up.mp3", NULL }; +#include "focusurgent.c" #include "movestack.c" static Key keys[] = { /* modifier key function argument */ @@ -129,6 +130,7 @@ static 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,15 @@ +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); + } + } +}