diff options
author | mliszcz <liszcz.michal@gmail.com> | 2019-03-23 11:32:44 +0100 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-03-23 17:49:27 -0400 |
commit | 200833caaea36dd65324e5460520731f5c98ff8a (patch) | |
tree | c0ecf9b611435f19a62682a0ee0feb564aa29acb /sway/tree/root.c | |
parent | fix opening a floating view on the NOOP output (diff) | |
download | sway-200833caaea36dd65324e5460520731f5c98ff8a.tar.gz sway-200833caaea36dd65324e5460520731f5c98ff8a.tar.zst sway-200833caaea36dd65324e5460520731f5c98ff8a.zip |
Allow for workspace renaming during exec handling
This change adds support for renaming a workspace when `exec` command
is being processed by keeping sway_workspace and pid_workspace names in
sync.
The change can be verified by running following command:
swaymsg exec <application>; swaymsg rename workspace number 1 to 5
Fixes: #3952
Diffstat (limited to 'sway/tree/root.c')
-rw-r--r-- | sway/tree/root.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c index 0744192b..5dde9f22 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c | |||
@@ -390,3 +390,17 @@ void root_get_box(struct sway_root *root, struct wlr_box *box) { | |||
390 | box->width = root->width; | 390 | box->width = root->width; |
391 | box->height = root->height; | 391 | box->height = root->height; |
392 | } | 392 | } |
393 | |||
394 | void root_rename_pid_workspaces(const char *old_name, const char *new_name) { | ||
395 | if (!pid_workspaces.prev && !pid_workspaces.next) { | ||
396 | wl_list_init(&pid_workspaces); | ||
397 | } | ||
398 | |||
399 | struct pid_workspace *pw = NULL; | ||
400 | wl_list_for_each(pw, &pid_workspaces, link) { | ||
401 | if (strcmp(pw->workspace, old_name) == 0) { | ||
402 | free(pw->workspace); | ||
403 | pw->workspace = strdup(new_name); | ||
404 | } | ||
405 | } | ||
406 | } | ||