diff --git a/src/con.c b/src/con.c index 52c78d0c..0f913e0a 100644 --- a/src/con.c +++ b/src/con.c @@ -1298,6 +1298,13 @@ bool con_move_to_mark(Con *con, const char *mark) { return false; } + /* For target containers in the scratchpad, we just send the window to the scratchpad. */ + if (con_get_workspace(target) == workspace_get("__i3_scratch", NULL)) { + DLOG("target container is in the scratchpad, moving container to scratchpad.\n"); + scratchpad_move(con); + return true; + } + /* For floating target containers, we just send the window to the same workspace. */ if (con_is_floating(target)) { DLOG("target container is floating, moving container to target's workspace.\n"); diff --git a/testcases/t/243-move-to-mark.t b/testcases/t/243-move-to-mark.t index 5e806cd4..b6ec462e 100644 --- a/testcases/t/243-move-to-mark.t +++ b/testcases/t/243-move-to-mark.t @@ -24,6 +24,7 @@ use i3test; my ($A, $B, $S, $M, $F, $source_ws, $target_ws, $ws); my ($nodes, $focus); +my $__i3_scratch; my $cmd_result; my $_NET_WM_STATE_REMOVE = 0; @@ -401,6 +402,29 @@ is(@{$nodes}, 2, 'there is a window and a container with the contents of the ori is($nodes->[0]->{window}, $M->{id}, 'M remains the first window'); is(@{get_ws($target_ws)->{floating_nodes}}, 1, 'target workspace has the floating container'); +############################################################################### +# Given 'S' and 'M', where 'S' is a container and 'M' is a container hidden in +# the scratchpad, then move 'S' to the scratchpad +############################################################################### + +$ws = fresh_workspace; +$S = open_window; +cmd 'mark S'; +$M = open_window; +cmd 'mark target'; +cmd 'move container to scratchpad'; + +cmd '[con_mark=S] move container to mark target'; +sync_with_i3; + +($nodes, $focus) = get_ws_content($ws); +is(@{$nodes}, 0, 'there are no tiling windows on the workspace'); +is(@{get_ws($ws)->{floating_nodes}}, 0, 'there are no floating containers on the workspace'); + +$__i3_scratch = get_ws('__i3_scratch'); +is(@{$__i3_scratch->{nodes}}, 0, 'there are no tiling windows on the scratchpad workspace'); +is(@{$__i3_scratch->{floating_nodes}}, 2, 'there are two floating containers in the scratchpad'); + ############################################################################### done_testing;