diff options
-rw-r--r-- | sway/commands/sticky.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sway/commands/sticky.c b/sway/commands/sticky.c index 732ccb98..a0dd7215 100644 --- a/sway/commands/sticky.c +++ b/sway/commands/sticky.c | |||
@@ -36,5 +36,21 @@ struct cmd_results *cmd_sticky(int argc, char **argv) { | |||
36 | 36 | ||
37 | container->is_sticky = wants_sticky; | 37 | container->is_sticky = wants_sticky; |
38 | 38 | ||
39 | if (wants_sticky) { | ||
40 | // move container to focused workspace | ||
41 | struct sway_container *output = container_parent(container, C_OUTPUT); | ||
42 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
43 | struct sway_container *focus = seat_get_focus_inactive(seat, output); | ||
44 | struct sway_container *focused_workspace = container_parent(focus, C_WORKSPACE); | ||
45 | struct sway_container *current_workspace = container_parent(container, C_WORKSPACE); | ||
46 | if (current_workspace != focused_workspace) { | ||
47 | container_move_to(container, focused_workspace); | ||
48 | arrange_windows(focused_workspace); | ||
49 | if (!container_reap_empty(current_workspace)) { | ||
50 | arrange_windows(current_workspace); | ||
51 | } | ||
52 | } | ||
53 | } | ||
54 | |||
39 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 55 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
40 | } | 56 | } |