diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sway/commands.c b/sway/commands.c index 07e7e53d..5e84ea9a 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -549,12 +549,19 @@ static struct cmd_results *cmd_exec_always(int argc, char **argv) { | |||
549 | close(fd[0]); | 549 | close(fd[0]); |
550 | // cleanup child process | 550 | // cleanup child process |
551 | wait(0); | 551 | wait(0); |
552 | if (*child > 0) { | 552 | swayc_t *ws = swayc_active_workspace(); |
553 | sway_log(L_DEBUG, "Child process created with pid %d", *child); | 553 | if (*child > 0 && ws) { |
554 | sway_log(L_DEBUG, "Child process created with pid %d for workspace %s", *child, ws->name); | ||
555 | struct pid_workspace *pw = malloc(sizeof(struct pid_workspace)); | ||
556 | pw->pid = child; | ||
557 | pw->workspace = strdup(ws->name); | ||
558 | pid_workspace_add(pw); | ||
554 | // TODO: keep track of this pid and open the corresponding view on the current workspace | 559 | // TODO: keep track of this pid and open the corresponding view on the current workspace |
555 | // blocked pending feature in wlc | 560 | // blocked pending feature in wlc |
561 | } else { | ||
562 | free(child); | ||
556 | } | 563 | } |
557 | free(child); | 564 | |
558 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 565 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
559 | } | 566 | } |
560 | 567 | ||