aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2018-08-18 18:29:18 +0100
committerIan Fan <ianfan0@gmail.com>2018-08-18 18:29:18 +0100
commit37e37627cae0a23d9f763cc56378b528f2ff3885 (patch)
tree589c0508752b93f2dcb64b207691ca7fc4258b90 /sway
parentb3f7801fca21dc792020a407050ae993615c293d (diff)
commands: move newly-stickied containers to focused workspace
Diffstat (limited to 'sway')
-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);
}