Adding cool autostart patch
This commit is contained in:
28
patch/cool_autostart.c
Normal file
28
patch/cool_autostart.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* dwm will keep pid's of processes from autostart array and kill them at quit */
|
||||
static pid_t *autostart_pids;
|
||||
static size_t autostart_len;
|
||||
|
||||
/* execute command from autostart array */
|
||||
static void
|
||||
autostart_exec()
|
||||
{
|
||||
const char *const *p;
|
||||
size_t i = 0;
|
||||
|
||||
/* count entries */
|
||||
for (p = autostart; *p; autostart_len++, p++)
|
||||
while (*++p);
|
||||
|
||||
autostart_pids = malloc(autostart_len * sizeof(pid_t));
|
||||
for (p = autostart; *p; i++, p++) {
|
||||
if ((autostart_pids[i] = fork()) == 0) {
|
||||
setsid();
|
||||
execvp(*p, (char *const *)p);
|
||||
fprintf(stderr, "dwm: execvp %s\n", *p);
|
||||
perror(" failed");
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
/* skip arguments */
|
||||
while (*++p);
|
||||
}
|
||||
}
|
1
patch/cool_autostart.h
Normal file
1
patch/cool_autostart.h
Normal file
@ -0,0 +1 @@
|
||||
static void autostart_exec(void);
|
@ -76,6 +76,9 @@
|
||||
#if CMDCUSTOMIZE_PATCH
|
||||
#include "cmdcustomize.c"
|
||||
#endif
|
||||
#if COOL_AUTOSTART_PATCH
|
||||
#include "cool_autostart.c"
|
||||
#endif
|
||||
#if CYCLELAYOUTS_PATCH
|
||||
#include "cyclelayouts.c"
|
||||
#endif
|
||||
|
@ -73,6 +73,9 @@
|
||||
#if CMDCUSTOMIZE_PATCH
|
||||
#include "cmdcustomize.h"
|
||||
#endif
|
||||
#if COOL_AUTOSTART_PATCH
|
||||
#include "cool_autostart.h"
|
||||
#endif
|
||||
#if CYCLELAYOUTS_PATCH
|
||||
#include "cyclelayouts.h"
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user