summaryrefslogtreecommitdiff
path: root/sway/commands/sticky.c
diff options
context:
space:
mode:
authorRyan Dwyer <[email protected]>2018-08-19 16:16:32 +1000
committerGitHub <[email protected]>2018-08-19 16:16:32 +1000
commit389d159c81502aa8b951895de11c3720bbd5ba7d (patch)
treec5d96041e3270b1d1d50f8a42d91652d615c9938 /sway/commands/sticky.c
parentd0a24465d75cc7197ee253e1de9fa961071cd034 (diff)
parent7f22fab3895ff090d5e26936f4e964e081090164 (diff)
Merge pull request #2453 from ianyfan/commands
More commands
Diffstat (limited to 'sway/commands/sticky.c')
-rw-r--r--sway/commands/sticky.c16
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) {
container->is_sticky = wants_sticky;
+ if (wants_sticky) {
+ // move container to focused workspace
+ struct sway_container *output = container_parent(container, C_OUTPUT);
+ struct sway_seat *seat = input_manager_current_seat(input_manager);
+ struct sway_container *focus = seat_get_focus_inactive(seat, output);
+ struct sway_container *focused_workspace = container_parent(focus, C_WORKSPACE);
+ struct sway_container *current_workspace = container_parent(container, C_WORKSPACE);
+ if (current_workspace != focused_workspace) {
+ container_move_to(container, focused_workspace);
+ arrange_windows(focused_workspace);
+ if (!container_reap_empty(current_workspace)) {
+ arrange_windows(current_workspace);
+ }
+ }
+ }
+
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}