summaryrefslogtreecommitdiff
path: root/sway/commands.c
diff options
context:
space:
mode:
authorZandr Martin <[email protected]>2016-06-06 06:58:53 -0500
committerZandr Martin <[email protected]>2016-06-06 06:58:53 -0500
commit0f1859ed25741927117b31cdd3ef2560f0327688 (patch)
treeb6c39b0757bb538e70f65dae46e41a298161cff3 /sway/commands.c
parentd4eb964fd1017ecc7dacfe6925ee18faa5c1dbcd (diff)
messy, unfinished version
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 83a9e7e9..08920c1c 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -549,12 +549,19 @@ static struct cmd_results *cmd_exec_always(int argc, char **argv) {
close(fd[0]);
// cleanup child process
wait(0);
- if (*child > 0) {
- sway_log(L_DEBUG, "Child process created with pid %d", *child);
+ swayc_t *ws = swayc_active_workspace();
+ if (*child > 0 && ws) {
+ sway_log(L_DEBUG, "Child process created with pid %d for workspace %s", *child, ws->name);
+ struct pid_workspace *pw = malloc(sizeof(struct pid_workspace));
+ pw->pid = child;
+ pw->workspace = strdup(ws->name);
+ list_add(config->pid_workspaces, pw);
// TODO: keep track of this pid and open the corresponding view on the current workspace
// blocked pending feature in wlc
+ } else {
+ free(child);
}
- free(child);
+
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}