Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Sravan Balaji
2022-09-01 21:18:41 -04:00
5 changed files with 55 additions and 67 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): 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 ```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/) - [noborder](https://dwm.suckless.org/patches/noborder/)
- removes the border when there is only one window visible - removes the border when there is only one window visible
- [nodmenu](https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html) - [~nodmenu~](https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html)
- enable modifying dmenu in config.def.h which resulted previously in a compilation error - ~enable modifying dmenu in config.def.h which resulted previously in a compilation error~
because two lines of code hardcode dmenu into dwm ~because two lines of code hardcode dmenu into dwm~
- allows complete removal of dmenu, should you want to do that - ~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 - ~NB: this patch was removed from the patches listing on the suckless page due to it's simplicity~
- ~merged upstream~
- nomodbuttons - nomodbuttons
- allows for toggleable client button bindings that have no modifiers - 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 - 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 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 - when terminals have transparency then their borders also become transparent
- this patch ensures that borders have no transparency - this patch ensures that borders have no transparency
- note that this patch is only relevant if you are not using the alpha patch - 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/) - [scratchpad](https://dwm.suckless.org/patches/scratchpad/)
- the scratchpad patch allows you to spawn or restore a floating terminal window - 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 - this alternative patch enables a scratchpad feature in dwm similar to the scratchpad
feature in i3wm feature in i3wm
- seamless_restart - seamless\_restart
- allows for selected layout, assigned tags, etc. to be persisted across restarts - allows for selected layout, assigned tags, etc. to be persisted across restarts
- [selfrestart](https://dwm.suckless.org/patches/selfrestart/) - [selfrestart](https://dwm.suckless.org/patches/selfrestart/)
- restart dwm without the unnecessary dependency of an external script - 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 - minor patch that allow clients to keep focus when being sent to another monitor
- [setborderpx](https://dwm.suckless.org/patches/setborderpx/) - [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 similar functionality by explicitly sorting screens left to right (or top to bottom in a
vertical layout) 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 - spawns programs from currently focused client's working directory
- [stacker](https://dwm.suckless.org/patches/stacker/) - [stacker](https://dwm.suckless.org/patches/stacker/)

View File

@@ -112,7 +112,6 @@
- [[#name-tag][Name Tag]] - [[#name-tag][Name Tag]]
- [[#net-client-list-stacking][Net Client List Stacking]] - [[#net-client-list-stacking][Net Client List Stacking]]
- [[#no-border][No Border]] - [[#no-border][No Border]]
- [[#no-dmenu][No Dmenu]]
- [[#no-mod-buttons][No Mod Buttons]] - [[#no-mod-buttons][No Mod Buttons]]
- [[#no-transparent-borders][No Transparent Borders]] - [[#no-transparent-borders][No Transparent Borders]]
- [[#on-empty-keys][On Empty Keys]] - [[#on-empty-keys][On Empty Keys]]
@@ -278,7 +277,7 @@ exec dwm
* dwm flexipatch * dwm flexipatch
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 [[https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0][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 [[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]]: 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]]:
@@ -770,10 +769,11 @@ Browsing patches? There is a [[https://coggle.it/diagram/X9IiSSM6PTWOM9Wz][map o
- [[https://dwm.suckless.org/patches/noborder/][noborder]] - [[https://dwm.suckless.org/patches/noborder/][noborder]]
- removes the border when there is only one window visible - removes the border when there is only one window visible
- [[https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html][nodmenu]] - +[[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 - +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 - +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 - +NB: this patch was removed from the patches listing on the suckless page due to it's simplicity+
- +merged upstream+
- nomodbuttons - nomodbuttons
- allows for toggleable client button bindings that have no modifiers - allows for toggleable client button bindings that have no modifiers
@@ -2344,16 +2344,6 @@ https://dwm.suckless.org/patches/noborder/
#define NOBORDER_PATCH 0 #define NOBORDER_PATCH 0
#+END_SRC #+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 1
#+END_SRC
*** No Mod Buttons *** No Mod Buttons
This patch allows for toggleable client button bindings that have no modifiers. This patch allows for toggleable client button bindings that have no modifiers.
@@ -4555,18 +4545,9 @@ static const char *xkb_layouts[] = {
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
#+END_SRC #+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
#+END_SRC
#+BEGIN_SRC c :tangle config.def.h #+BEGIN_SRC c :tangle config.def.h
static const char *dmenucmd[] = { static const char *dmenucmd[] = {
"dmenu_run", "dmenu_run",
#if !NODMENU_PATCH
"-m", dmenumon,
#endif // NODMENU_PATCH
"-fn", dmenufont, "-fn", dmenufont,
"-nb", normbgcolor, "-nb", normbgcolor,
"-nf", normfgcolor, "-nf", normfgcolor,
@@ -4580,7 +4561,7 @@ static const char *dmenucmd[] = {
static const char *termcmd[] = { "kitty", NULL }; static const char *termcmd[] = { "kitty", NULL };
static const char *roficmd[] = { "rofi", "-show", "combi", NULL }; static const char *roficmd[] = { "rofi", "-show", "combi", NULL };
static const char *controlcentercmd[] = { "/home/sravan/.scripts/control-center.sh", "--rofi", NULL }; static const char *controlcentercmd[] = { "/home/sravan/.scripts/control-center.sh", "--rofi", NULL };
static const char *brightnesscmd[] = { "/home/sravan/.scripts/brightness.sh", "--rofi", NULL }; static const char *brightnesscmd[] = { "/home/sravan/.scripts/brightness.sh", "--rofi", NULL };
static const char *clipboardcmd[] = { "rofi", "-show", "clipboard", NULL }; static const char *clipboardcmd[] = { "rofi", "-show", "clipboard", NULL };
static const char *rbwcmd[] = { "rofi-rbw", NULL }; static const char *rbwcmd[] = { "rofi-rbw", NULL };
static const char *volumecmd[] = { "/home/sravan/.scripts/pactl.sh", "--rofi", NULL }; static const char *volumecmd[] = { "/home/sravan/.scripts/pactl.sh", "--rofi", NULL };
@@ -5419,7 +5400,7 @@ static Signal signals[] = {
#+BEGIN_SRC c :tangle config.def.h #+BEGIN_SRC c :tangle config.def.h
#if IPC_PATCH #if IPC_PATCH
static const char *ipcsockpath = "/tmp/dwm.sock"; static const char *ipcsockpath = "/tmp/dwm.sock";
static const IPCCommand ipccommands[] = { static IPCCommand ipccommands[] = {
IPCCOMMAND( focusmon, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( focusmon, 1, {ARG_TYPE_SINT} ),
IPCCOMMAND( focusstack, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( focusstack, 1, {ARG_TYPE_SINT} ),
IPCCOMMAND( incnmaster, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( incnmaster, 1, {ARG_TYPE_SINT} ),

View File

@@ -827,15 +827,8 @@ static const char *xkb_layouts[] = {
/* helper for spawning shell commands in the pre dwm-5.0 fashion */ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } #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[] = { static const char *dmenucmd[] = {
"dmenu_run", "dmenu_run",
#if !NODMENU_PATCH
"-m", dmenumon,
#endif // NODMENU_PATCH
"-fn", dmenufont, "-fn", dmenufont,
"-nb", normbgcolor, "-nb", normbgcolor,
"-nf", normfgcolor, "-nf", normfgcolor,
@@ -849,7 +842,7 @@ static const char *dmenucmd[] = {
static const char *termcmd[] = { "kitty", NULL }; static const char *termcmd[] = { "kitty", NULL };
static const char *roficmd[] = { "rofi", "-show", "combi", NULL }; static const char *roficmd[] = { "rofi", "-show", "combi", NULL };
static const char *controlcentercmd[] = { "/home/sravan/.scripts/control-center.sh", "--rofi", NULL }; static const char *controlcentercmd[] = { "/home/sravan/.scripts/control-center.sh", "--rofi", NULL };
static const char *brightnesscmd[] = { "/home/sravan/.scripts/brightness.sh", "--rofi", NULL }; static const char *brightnesscmd[] = { "/home/sravan/.scripts/brightness.sh", "--rofi", NULL };
static const char *clipboardcmd[] = { "rofi", "-show", "clipboard", NULL }; static const char *clipboardcmd[] = { "rofi", "-show", "clipboard", NULL };
static const char *rbwcmd[] = { "rofi-rbw", NULL }; static const char *rbwcmd[] = { "rofi-rbw", NULL };
static const char *volumecmd[] = { "/home/sravan/.scripts/pactl.sh", "--rofi", NULL }; static const char *volumecmd[] = { "/home/sravan/.scripts/pactl.sh", "--rofi", NULL };
@@ -1672,7 +1665,7 @@ static Signal signals[] = {
#if IPC_PATCH #if IPC_PATCH
static const char *ipcsockpath = "/tmp/dwm.sock"; static const char *ipcsockpath = "/tmp/dwm.sock";
static const IPCCommand ipccommands[] = { static IPCCommand ipccommands[] = {
IPCCOMMAND( focusmon, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( focusmon, 1, {ARG_TYPE_SINT} ),
IPCCOMMAND( focusstack, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( focusstack, 1, {ARG_TYPE_SINT} ),
IPCCOMMAND( incnmaster, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( incnmaster, 1, {ARG_TYPE_SINT} ),

51
dwm.c
View File

@@ -55,6 +55,10 @@
#include <pango/pango.h> #include <pango/pango.h>
#endif // BAR_PANGO_PATCH #endif // BAR_PANGO_PATCH
#if RESTARTSIG_PATCH
#include <poll.h>
#endif // RESTARTSIG_PATCH
#if XKB_PATCH #if XKB_PATCH
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#endif // XKB_PATCH #endif // XKB_PATCH
@@ -819,7 +823,11 @@ static Atom clientatom[ClientLast];
#if ON_EMPTY_KEYS_PATCH #if ON_EMPTY_KEYS_PATCH
static int isempty = 0; static int isempty = 0;
#endif // ON_EMPTY_KEYS_PATCH #endif // ON_EMPTY_KEYS_PATCH
#if RESTARTSIG_PATCH
static volatile sig_atomic_t running = 1;
#else
static int running = 1; static int running = 1;
#endif // RESTARTSIG_PATCH
static Cur *cursor[CurLast]; static Cur *cursor[CurLast];
static Clr **scheme; static Clr **scheme;
static Display *dpy; static Display *dpy;
@@ -3186,6 +3194,30 @@ run(void)
} }
} }
} }
#elif RESTARTSIG_PATCH
void
run(void)
{
XEvent ev;
XSync(dpy, False);
/* main event loop */
while (running) {
struct pollfd pfd = {
.fd = ConnectionNumber(dpy),
.events = POLLIN,
};
int pending = XPending(dpy) > 0 || poll(&pfd, 1, -1) > 0;
if (!running)
break;
if (!pending)
continue;
XNextEvent(dpy, &ev);
if (handler[ev.type])
handler[ev.type](&ev); /* call handler */
}
}
#else #else
void void
run(void) run(void)
@@ -3208,7 +3240,7 @@ run(void)
handler[ev.type](&ev); /* call handler */ handler[ev.type](&ev); /* call handler */
} }
} }
#endif // IPC_PATCH #endif // IPC_PATCH | RESTARTSIG_PATCH
void void
scan(void) scan(void)
@@ -3921,10 +3953,6 @@ spawn(const Arg *arg)
#if RIODRAW_PATCH #if RIODRAW_PATCH
pid_t pid; pid_t pid;
#endif // RIODRAW_PATCH #endif // RIODRAW_PATCH
#if !NODMENU_PATCH
if (arg->v == dmenucmd)
dmenumon[0] = '0' + selmon->num;
#endif // NODMENU_PATCH
#if RIODRAW_PATCH #if RIODRAW_PATCH
if ((pid = fork()) == 0) if ((pid = fork()) == 0)
@@ -5044,7 +5072,6 @@ main(int argc, char *argv[])
else if (!strcmp("-sf", argv[i])) /* selected foreground color */ else if (!strcmp("-sf", argv[i])) /* selected foreground color */
colors[SchemeSel][0] = argv[++i]; colors[SchemeSel][0] = argv[++i];
#endif // !BAR_VTCOLORS_PATCH #endif // !BAR_VTCOLORS_PATCH
#if NODMENU_PATCH
else if (!strcmp("-df", argv[i])) /* dmenu font */ else if (!strcmp("-df", argv[i])) /* dmenu font */
dmenucmd[2] = argv[++i]; dmenucmd[2] = argv[++i];
else if (!strcmp("-dnb", argv[i])) /* dmenu normal background color */ else if (!strcmp("-dnb", argv[i])) /* dmenu normal background color */
@@ -5055,18 +5082,6 @@ main(int argc, char *argv[])
dmenucmd[8] = argv[++i]; dmenucmd[8] = argv[++i];
else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */ else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */
dmenucmd[10] = argv[++i]; 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 die(help());
#else #else
if (argc == 2 && !strcmp("-v", argv[1])) if (argc == 2 && !strcmp("-v", argv[1]))

View File

@@ -215,8 +215,6 @@
#define NOBORDER_PATCH 0 #define NOBORDER_PATCH 0
#define NODMENU_PATCH 1
#define NO_MOD_BUTTONS_PATCH 0 #define NO_MOD_BUTTONS_PATCH 0
#define NO_TRANSPARENT_BORDERS_PATCH 1 #define NO_TRANSPARENT_BORDERS_PATCH 1