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/README.org b/README.org index 4ece963..4c0a6b1 100644 --- a/README.org +++ b/README.org @@ -113,6 +113,7 @@ - [[#name-tag][Name Tag]] - [[#net-client-list-stacking][Net Client List Stacking]] - [[#no-border][No Border]] + - [[#no-dmenu][No Dmenu]] - [[#no-mod-buttons][No Mod Buttons]] - [[#no-transparent-borders][No Transparent Borders]] - [[#on-empty-keys][On Empty Keys]] @@ -278,7 +279,7 @@ exec dwm * dwm flexipatch -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 [[https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0][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 [[https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0][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 [[https://github.com/bakkeby/dwm-flexipatch/blob/master/patches.def.h][patches.h]]: @@ -775,11 +776,11 @@ Browsing patches? There is a [[https://coggle.it/diagram/X9IiSSM6PTWOM9Wz][map o - [[https://dwm.suckless.org/patches/noborder/][noborder]] - removes the border when there is only one window visible - - +[[https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html][nodmenu]]+ - - +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+ + - [[https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html][nodmenu]] + - 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 @@ -2358,6 +2359,16 @@ https://dwm.suckless.org/patches/noborder/ #define NOBORDER_PATCH 0 #+END_SRC +*** No Dmenu + +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/ + +#+BEGIN_SRC c :tangle patches.def.h +#define NODMENU_PATCH 0 +#+END_SRC + *** No Mod Buttons This patch allows for toggleable client button bindings that have no modifiers. @@ -4576,8 +4587,14 @@ static const char *xkb_layouts[] = { #+END_SRC #+BEGIN_SRC c :tangle config.def.h +#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/config.def.h b/config.def.h index 2e95641..030b5cd 100644 --- a/config.def.h +++ b/config.def.h @@ -837,8 +837,14 @@ static const char *xkb_layouts[] = { /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } +#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 58c7823..43c0464 100644 --- a/patches.def.h +++ b/patches.def.h @@ -217,6 +217,8 @@ #define NOBORDER_PATCH 0 +#define NODMENU_PATCH 0 + #define NO_MOD_BUTTONS_PATCH 0 #define NO_TRANSPARENT_BORDERS_PATCH 1