diff --git a/README.md b/README.md index 1137046..322012a 100644 --- a/README.md +++ b/README.md @@ -276,6 +276,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - provides the ability to focus the tag on the immediate left or right of the currently focused tag - it also allows to send the focused window either on the left or the right tag + - [focusmaster](https://dwm.suckless.org/patches/focusmaster/) + - a simple patch that just puts focus back to the master client + - [focusonclick](https://dwm.suckless.org/patches/focusonclick/) - this patch makes you switch focus only by mouse click and not sloppy (focus follows mouse pointer) diff --git a/config.def.h b/config.def.h index 72d08ab..17d6568 100644 --- a/config.def.h +++ b/config.def.h @@ -895,6 +895,9 @@ static Key keys[] = { { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_b, togglebar, {0} }, + #if FOCUSMASTER_PATCH + { MODKEY|ControlMask, XK_space, focusmaster, {0} }, + #endif // FOCUSMASTER_PATCH #if STACKER_PATCH STACKKEYS(MODKEY, focus) STACKKEYS(MODKEY|ShiftMask, push) diff --git a/patch/focusmaster.c b/patch/focusmaster.c new file mode 100644 index 0000000..839fb43 --- /dev/null +++ b/patch/focusmaster.c @@ -0,0 +1,13 @@ +void +focusmaster(const Arg *arg) +{ + Client *c; + + if (selmon->nmaster < 1) + return; + + c = nexttiled(selmon->clients); + + if (c) + focus(c); +} \ No newline at end of file diff --git a/patch/focusmaster.h b/patch/focusmaster.h new file mode 100644 index 0000000..5732e4b --- /dev/null +++ b/patch/focusmaster.h @@ -0,0 +1 @@ +static void focusmaster(const Arg *arg); \ No newline at end of file diff --git a/patch/include.c b/patch/include.c index 68ff0c1..24293cd 100644 --- a/patch/include.c +++ b/patch/include.c @@ -105,6 +105,9 @@ #if FOCUSADJACENTTAG_PATCH #include "focusadjacenttag.c" #endif +#if FOCUSMASTER_PATCH +#include "focusmaster.c" +#endif #if FOCUSURGENT_PATCH #include "focusurgent.c" #endif diff --git a/patch/include.h b/patch/include.h index 6b695a1..2615109 100644 --- a/patch/include.h +++ b/patch/include.h @@ -105,6 +105,9 @@ #if FOCUSADJACENTTAG_PATCH #include "focusadjacenttag.h" #endif +#if FOCUSMASTER_PATCH +#include "focusmaster.h" +#endif #if FOCUSURGENT_PATCH #include "focusurgent.h" #endif diff --git a/patches.def.h b/patches.def.h index 797a14f..ce39c32 100644 --- a/patches.def.h +++ b/patches.def.h @@ -429,6 +429,11 @@ */ #define FOCUSADJACENTTAG_PATCH 0 +/* A simple patch that just puts focus back to the master client. + * https://dwm.suckless.org/patches/focusmaster/ + */ +#define FOCUSMASTER_PATCH 0 + /* Switch focus only by mouse click and not sloppy (focus follows mouse pointer). * https://dwm.suckless.org/patches/focusonclick/ */