[wiki] [sites] Add spawnprograms patch to dwm.suckless.org || Zsolt Vadasz
commit 91511e7c3db3814cc32927d896582b1fdd2df5fd
Author: Zsolt Vadasz <zsolt_vadasz_AT_protonmail.com>
Date: Mon May 3 17:58:17 2021 +0200
Add spawnprograms patch to dwm.suckless.org
Added the spawnprograms patch which spawn()s the given
programs on startup. It reads the program names from the
startup_programs variable which the user has to add to their config.h.
diff --git a/dwm.suckless.org/patches/spawnprograms/dwm-spawnprograms-6.2.diff b/dwm.suckless.org/patches/spawnprograms/dwm-spawnprograms-6.2.diff
new file mode 100644
index 00000000..884dd232
--- /dev/null
+++ b/dwm.suckless.org/patches/spawnprograms/dwm-spawnprograms-6.2.diff
_AT_@ -0,0 +1,42 @@
+Only in dwm-6.2-patched: config.h
+Only in dwm-6.2-patched: drw.o
+Only in dwm-6.2-patched: dwm
+diff -up dwm-6.2/dwm.c dwm-6.2-patched/dwm.c
+--- dwm-6.2/dwm.c 2019-02-02 13:55:28.000000000 +0100
++++ dwm-6.2-patched/dwm.c 2021-05-03 16:21:31.571201407 +0200
+_AT_@ -233,6 +233,7 @@ static int xerror(Display *dpy, XErrorEv
+ static int xerrordummy(Display *dpy, XErrorEvent *ee);
+ static int xerrorstart(Display *dpy, XErrorEvent *ee);
+ static void zoom(const Arg *arg);
++static void spawnprograms();
+
+ /* variables */
+ static const char broken[] = "broken";
+_AT_@ -2124,6 +2125,17 @@ zoom(const Arg *arg)
+ pop(c);
+ }
+
++void
++spawnprograms()
++{
++ /* iterate through startup_programs and spawn each program */
++ for(int i = 0; i < sizeof(startup_programs) / sizeof(char **); i++)
++ {
++ Arg prog = {.v = startup_programs[i]};
++ spawn(&prog);
++ }
++}
++
+ int
+ main(int argc, char *argv[])
+ {
+_AT_@ -2142,6 +2154,7 @@ main(int argc, char *argv[])
+ die("pledge");
+ #endif /* __OpenBSD__ */
+ scan();
++ spawnprograms();
+ run();
+ cleanup();
+ XCloseDisplay(dpy);
+Only in dwm-6.2-patched: dwm.o
+Only in dwm-6.2-patched: util.o
diff --git a/dwm.suckless.org/patches/spawnprograms/index.md b/dwm.suckless.org/patches/spawnprograms/index.md
new file mode 100644
index 00000000..d29494cc
--- /dev/null
+++ b/dwm.suckless.org/patches/spawnprograms/index.md
_AT_@ -0,0 +1,28 @@
+spawnprograms
+=============
+
+Description
+-----------
+
+This patch spawns each command in the `startup_programs` array on startup.
+It's similar to the [autostart](../autostart/) patch,
+however unlike autostart, it doesn't read anything from external files.
+
+Example usage (put this into your `config.h`):
+
+``
+static const char **startup_programs[] = {
+ termcmd,
+ someothercmd,
+};
+``
+
+Download
+--------
+
+[dwm-spawnprograms-6.2.diff](dwm-spawnprograms-6.2.diff)
+
+Author
+------
+
+* Zsolt Vadász <zsolt_vadasz_AT_protonmail.com>
Received on Mon May 03 2021 - 18:05:05 CEST
This archive was generated by hypermail 2.3.0
: Mon May 03 2021 - 18:12:53 CEST