diff --git a/README.md b/README.md index d678005..61a01d7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2019-10-02 - Added restartsig, emptyview and focusadjacenttag patches +2019-10-02 - Added restartsig, emptyview, focusurgent and focusadjacenttag patches 2019-10-01 - Added leftlayout, fullscreen, holdbar and unfloatvisible patches @@ -112,6 +112,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - by default, dwm responds to \_NET_ACTIVE_WINDOW client messages by setting the urgency bit on the named window - this patch activates the window instead + - [focusurgent](https://dwm.suckless.org/patches/focusurgent/) + - adds a keyboard shortcut to select the next window having the urgent flag regardless of the tag it is on + - [fullscreen](https://dwm.suckless.org/patches/fullscreen/) - applies the monocle layout with the focused client on top and hides the bar - when pressed again it shows the bar and restores the layout that was active before going fullscreen diff --git a/config.def.h b/config.def.h index 4459f49..857acc2 100644 --- a/config.def.h +++ b/config.def.h @@ -361,6 +361,9 @@ static Key keys[] = { #if RESTARTSIG_PATCH { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} }, #endif // RESTARTSIG_PATCH + #if FOCUSURGENT_PATCH + { MODKEY, XK_u, focusurgent, {0} }, + #endif // FOCUSURGENT_PATCH #if HOLDBAR_PATCH { 0, HOLDKEY, holdbar, {0} }, #endif // HOLDBAR_PATCH diff --git a/patch/focusurgent.c b/patch/focusurgent.c new file mode 100644 index 0000000..67d71bc --- /dev/null +++ b/patch/focusurgent.c @@ -0,0 +1,15 @@ +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); + } + } +} \ No newline at end of file diff --git a/patch/focusurgent.h b/patch/focusurgent.h new file mode 100644 index 0000000..27ab8ac --- /dev/null +++ b/patch/focusurgent.h @@ -0,0 +1 @@ +static void focusurgent(const Arg *arg); \ No newline at end of file diff --git a/patch/include.c b/patch/include.c index 82b151b..cd52548 100644 --- a/patch/include.c +++ b/patch/include.c @@ -40,6 +40,10 @@ #include "focusadjacenttag.c" #endif +#if FOCUSURGENT_PATCH +#include "focusurgent.c" +#endif + #if FULLSCREEN_PATCH #include "fullscreen.c" #endif diff --git a/patch/include.h b/patch/include.h index 74b5404..ca2940a 100644 --- a/patch/include.h +++ b/patch/include.h @@ -40,6 +40,10 @@ #include "focusadjacenttag.h" #endif +#if FOCUSURGENT_PATCH +#include "focusurgent.h" +#endif + #if FULLSCREEN_PATCH #include "fullscreen.h" #endif diff --git a/patches.h b/patches.h index c65bfe3..95002a2 100644 --- a/patches.h +++ b/patches.h @@ -137,13 +137,20 @@ * the right tag. * http://dwm.suckless.org/patches/focusadjacenttag/ */ -#define FOCUSADJACENTTAG_PATCH 1 +#define FOCUSADJACENTTAG_PATCH 0 /* Switch focus only by mouse click and not sloppy (focus follows mouse pointer). * https://dwm.suckless.org/patches/focusonclick/ */ #define FOCUSONCLICK_PATCH 0 +/* Selects the next window having the urgent flag regardless of the tag it is on. + * The urgent flag can be artificially set with the following xdotool command on any window: + * xdotool selectwindow -- set_window --urgency 1 + * https://dwm.suckless.org/patches/focusurgent/ + */ +#define FOCUSURGENT_PATCH 0 + /* This patch allows a different border color to be chosen for floating windows. * https://dwm.suckless.org/patches/float_border_color/ */