diff --git a/README.md b/README.md index 53faf27..444c9dd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -This dwm 6.4 (50ad171, 2022-10-04) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0). +This dwm 6.4 (ba56fe9, 2022-10-28) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0). For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/dwm-flexipatch/blob/master/patches.def.h): ```c @@ -545,12 +545,11 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6 - [noborder](https://dwm.suckless.org/patches/noborder/) - removes the border when there is only one window visible - - [~nodmenu~](https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html) - - ~enable modifying dmenu in config.def.h which resulted previously in a compilation error~ - ~because two lines of code hardcode dmenu into dwm~ - - ~allows complete removal of dmenu, should you want to do that~ - - ~NB: this patch was removed from the patches listing on the suckless page due to it's simplicity~ - - ~merged upstream~ + - [nodmenu](https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html) + - enable modifying dmenu in config.def.h which resulted previously in a compilation error + because two lines of code hardcode dmenu into dwm + - allows complete removal of dmenu, should you want to do that + - NB: this patch was removed from the patches listing on the suckless page due to it's simplicity - nomodbuttons - allows for toggleable client button bindings that have no modifiers diff --git a/config.def.h b/config.def.h index 5d10181..e030ee9 100644 --- a/config.def.h +++ b/config.def.h @@ -851,8 +851,14 @@ static const char *xkb_layouts[] = { #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* commands */ +#if !NODMENU_PATCH +static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +#endif // NODMENU_PATCH static const char *dmenucmd[] = { "dmenu_run", + #if !NODMENU_PATCH + "-m", dmenumon, + #endif // NODMENU_PATCH "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, diff --git a/dwm.c b/dwm.c index 25d57b6..df964a2 100644 --- a/dwm.c +++ b/dwm.c @@ -2060,7 +2060,11 @@ focus(Client *c) #endif // BAR_FLEXWINTITLE_PATCH setfocus(c); } else { + #if NODMENU_PATCH + XSetInputFocus(dpy, selmon->bar && selmon->bar->win ? selmon->bar->win : root, RevertToPointerRoot, CurrentTime); + #else XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + #endif // NODMENU_PATCH XDeleteProperty(dpy, root, netatom[NetActiveWindow]); } selmon->sel = c; @@ -3947,6 +3951,10 @@ spawn(const Arg *arg) #if RIODRAW_PATCH pid_t pid; #endif // RIODRAW_PATCH + #if !NODMENU_PATCH + if (arg->v == dmenucmd) + dmenumon[0] = '0' + selmon->num; + #endif // NODMENU_PATCH #if RIODRAW_PATCH if ((pid = fork()) == 0) @@ -5066,6 +5074,7 @@ main(int argc, char *argv[]) else if (!strcmp("-sf", argv[i])) /* selected foreground color */ colors[SchemeSel][0] = argv[++i]; #endif // !BAR_VTCOLORS_PATCH + #if NODMENU_PATCH else if (!strcmp("-df", argv[i])) /* dmenu font */ dmenucmd[2] = argv[++i]; else if (!strcmp("-dnb", argv[i])) /* dmenu normal background color */ @@ -5076,6 +5085,18 @@ main(int argc, char *argv[]) dmenucmd[8] = argv[++i]; else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */ dmenucmd[10] = argv[++i]; + #else + else if (!strcmp("-df", argv[i])) /* dmenu font */ + dmenucmd[4] = argv[++i]; + else if (!strcmp("-dnb", argv[i])) /* dmenu normal background color */ + dmenucmd[6] = argv[++i]; + else if (!strcmp("-dnf", argv[i])) /* dmenu normal foreground color */ + dmenucmd[8] = argv[++i]; + else if (!strcmp("-dsb", argv[i])) /* dmenu selected background color */ + dmenucmd[10] = argv[++i]; + else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */ + dmenucmd[12] = argv[++i]; + #endif // NODMENU_PATCH else die(help()); #else if (argc == 2 && !strcmp("-v", argv[1])) diff --git a/patches.def.h b/patches.def.h index e787ada..1429aa0 100644 --- a/patches.def.h +++ b/patches.def.h @@ -822,6 +822,12 @@ */ #define NOBORDER_PATCH 0 +/* Enable modifying or removing dmenu in config.def.h which resulted previously in a + * compilation error because two lines of code hardcode dmenu into dwm. + * https://dwm.suckless.org/patches/nodmenu/ + */ +#define NODMENU_PATCH 0 + /* This patch allows for toggleable client button bindings that have no modifiers. * This can, for example, allow you to move or resize using the mouse alone without holding * down a modifier key. This can be practical if you have extra buttons on your mouse.