diff options
| author | Abhinav Prasai <72694427+uint23@users.noreply.github.com> | 2025-06-04 19:51:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-04 19:51:19 +0100 |
| commit | 0582858f8693aa7455c4df5a7ff6440a5c31963d (patch) | |
| tree | 204f90bb37ff749edd2eab394a92de0f08767cab /src/sxwm.c | |
| parent | 485e2b676a0a2380274de2d1b5ad6c6cdc16ce7e (diff) | |
| parent | 7f79463c7b1881bdf1e7a76ebfd8d2a2e46213f4 (diff) | |
Merge pull request #58 from werdl/main
add exec config file keyword
Diffstat (limited to 'src/sxwm.c')
| -rw-r--r-- | src/sxwm.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -1335,6 +1335,32 @@ void setup(void) fprintf(stderr, "sxrc: error parsing config file\n"); init_defaults(); } + + for (int i = 0; i < 256; i++) { + if (user_config.torun[i]) { + printf("[DEBUG] executing %s\n", user_config.torun[i]); + pid_t pid = fork(); + if (pid == 0) { + char *argv[256]; + int j = 0; + char *arg = strtok(user_config.torun[i], " "); + while (arg && j < 256) { + argv[j++] = arg; + arg = strtok(NULL, " "); + } + argv[j] = NULL; + execvp(argv[0], argv); + perror("execvp"); + _exit(127); + } + else if (pid > 0) { + // parent: don’t wait, just continue (background) + } + else { + perror("fork"); + } + } + } grab_keys(); c_normal = XcursorLibraryLoadCursor(dpy, "left_ptr"); |
