Bump to c2b748e.

Remove dmenumon variable

Reasoning: Since 2011 dmenu has been capable of working out which
monitor currently has focus in a Xinerama setup, making the use
of the -m flag more or less redundant.

This is easily demonstrated by using dmenu in any other window
manager.

There used to be a nodmenu patch that provided these changes:
https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html

but this was removed on the basis that it was very easy to work
out and apply manually if needed.

The proposal here is to remove this dependency from dwm. The
mechanism of the dmenumon variable could be provided via a patch
if need be.

The edge case scenario that dmenu does not handle on its own, and
the effect of removing this mechanism, is that if the user trigger
focusmon via keybindings to change focus to another monitor that
has no clients, then dmenu will open on the monitor containing the
window with input focus (or the monitor with the mouse cursor if
no windows have input focus).

If this edge case is important to cover then this can be addressed
by setting input focus to selmon->barwin in the focus function if
there is no client to give focus to (rather than giving focus back
to the root window).

Ref.
https://git.suckless.org/dwm/commit/c2b748e7931e5f28984efc236f9b1a212dbc65e8.html
This commit is contained in:
bakkeby 2022-08-29 21:49:41 +02:00
parent 88eb89ab0d
commit 2c180b8d9c
4 changed files with 12 additions and 40 deletions

View File

@ -1,4 +1,4 @@
This dwm 6.3 (84d7322, 2022-08-18) 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.3 (c2b748e, 2022-08-26) 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
@ -540,18 +540,19 @@ 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
- [~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~
- nomodbuttons
- 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, which can be practical if you have extra buttons on your mouse
- [no_transparent_borders](https://github.com/szatanjl/dwm/commit/1529909466206016f2101457bbf37c67195714c8)
- [no\_transparent\_borders](https://github.com/szatanjl/dwm/commit/1529909466206016f2101457bbf37c67195714c8)
- when terminals have transparency then their borders also become transparent
- this patch ensures that borders have no transparency
- note that this patch is only relevant if you are not using the alpha patch
@ -619,17 +620,17 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [scratchpad](https://dwm.suckless.org/patches/scratchpad/)
- the scratchpad patch allows you to spawn or restore a floating terminal window
- [scratchpad_alt_1](https://github.com/GasparVardanyan/dwm-scratchpad)
- [scratchpad\_alt\_1](https://github.com/GasparVardanyan/dwm-scratchpad)
- this alternative patch enables a scratchpad feature in dwm similar to the scratchpad
feature in i3wm
- seamless_restart
- seamless\_restart
- allows for selected layout, assigned tags, etc. to be persisted across restarts
- [selfrestart](https://dwm.suckless.org/patches/selfrestart/)
- restart dwm without the unnecessary dependency of an external script
- [sendmon_keepfocus](https://github.com/bakkeby/patches/wiki/sendmon_keepfocus/)
- [sendmon\_keepfocus](https://github.com/bakkeby/patches/wiki/sendmon_keepfocus/)
- minor patch that allow clients to keep focus when being sent to another monitor
- [setborderpx](https://dwm.suckless.org/patches/setborderpx/)
@ -653,7 +654,7 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
similar functionality by explicitly sorting screens left to right (or top to bottom in a
vertical layout)
- [spawn_cwd](https://dwm.suckless.org/patches/spawn_cwd/)
- [spawn\_cwd](https://dwm.suckless.org/patches/spawn_cwd/)
- spawns programs from currently focused client's working directory
- [stacker](https://dwm.suckless.org/patches/stacker/)

View File

@ -841,14 +841,8 @@ 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,

17
dwm.c
View File

@ -3953,10 +3953,6 @@ 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)
@ -5076,7 +5072,6 @@ 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 */
@ -5087,18 +5082,6 @@ 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]))

View File

@ -819,12 +819,6 @@
*/
#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.