summaryrefslogtreecommitdiffstats
path: root/sway/commands/sticky.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/sticky.c')
-rw-r--r--sway/commands/sticky.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/sway/commands/sticky.c b/sway/commands/sticky.c
index 8692e08d..7995cdd6 100644
--- a/sway/commands/sticky.c
+++ b/sway/commands/sticky.c
@@ -15,8 +15,7 @@ struct cmd_results *cmd_sticky(int argc, char **argv) {
15 if ((error = checkarg(argc, "sticky", EXPECTED_EQUAL_TO, 1))) { 15 if ((error = checkarg(argc, "sticky", EXPECTED_EQUAL_TO, 1))) {
16 return error; 16 return error;
17 } 17 }
18 struct sway_container *container = 18 struct sway_container *container = config->handler_context.container;
19 config->handler_context.current_container;
20 if (!container_is_floating(container)) { 19 if (!container_is_floating(container)) {
21 return cmd_results_new(CMD_FAILURE, "sticky", 20 return cmd_results_new(CMD_FAILURE, "sticky",
22 "Can't set sticky on a tiled container"); 21 "Can't set sticky on a tiled container");
@@ -37,20 +36,16 @@ struct cmd_results *cmd_sticky(int argc, char **argv) {
37 container->is_sticky = wants_sticky; 36 container->is_sticky = wants_sticky;
38 37
39 if (wants_sticky) { 38 if (wants_sticky) {
40 // move container to focused workspace 39 // move container to active workspace
41 struct sway_container *output = container_parent(container, C_OUTPUT); 40 struct sway_workspace *active_workspace =
42 struct sway_seat *seat = input_manager_current_seat(input_manager); 41 output_get_active_workspace(container->workspace->output);
43 struct sway_container *focus = seat_get_focus_inactive(seat, output); 42 if (container->workspace != active_workspace) {
44 struct sway_container *focused_workspace = container_parent(focus, C_WORKSPACE); 43 struct sway_workspace *old_workspace = container->workspace;
45 struct sway_container *current_workspace = container_parent(container, C_WORKSPACE); 44 container_detach(container);
46 if (current_workspace != focused_workspace) { 45 workspace_add_floating(active_workspace, container);
47 container_remove_child(container); 46 container_handle_fullscreen_reparent(container);
48 workspace_add_floating(focused_workspace, container); 47 arrange_workspace(active_workspace);
49 container_handle_fullscreen_reparent(container, current_workspace); 48 workspace_consider_destroy(old_workspace);
50 arrange_windows(focused_workspace);
51 if (!container_reap_empty(current_workspace)) {
52 arrange_windows(current_workspace);
53 }
54 } 49 }
55 } 50 }
56 51