aboutsummaryrefslogtreecommitdiff
path: root/sway/commands.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-06-11 15:02:26 -0400
committerGitHub <noreply@github.com>2016-06-11 15:02:26 -0400
commit6388e1e288009fc12af3fe418a6faf8cfe9926f7 (patch)
treed1b4fb33848d09c71602005c57919a903ce3d72d /sway/commands.c
parentcb0cc32265136522f7bfbb768f55f35718248d71 (diff)
parent2298143d09ce8810d9772f95e1cb605fb6b08536 (diff)
Merge pull request #701 from zandrmartin/assign-command
messy start of a fix for #462
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 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) {
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);
+ pid_workspace_add(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);
}