sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 91511e7c3db3814cc32927d896582b1fdd2df5fd
parent 346993e10e90a48b9daba0320fe13ba892cd610a
Author: Zsolt Vadasz <zsolt_vadasz@protonmail.com>
Date:   Mon,  3 May 2021 17:58:17 +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.

Diffstat:
Adwm.suckless.org/patches/spawnprograms/dwm-spawnprograms-6.2.diff | 42++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/spawnprograms/index.md | 28++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/spawnprograms/dwm-spawnprograms-6.2.diff b/dwm.suckless.org/patches/spawnprograms/dwm-spawnprograms-6.2.diff @@ -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 +@@ -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"; +@@ -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[]) + { +@@ -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 @@ -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@protonmail.com>