Merge pull request #3776 from RedSoxFan/move-mark-scratchpad-hidden

cmd_move_to_mark: fix move to scratchpad hidden
This commit is contained in:
Orestis 2019-08-22 09:45:51 +03:00 committed by GitHub
commit 7b33e06b9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View File

@ -1298,6 +1298,13 @@ bool con_move_to_mark(Con *con, const char *mark) {
return false; 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. */ /* For floating target containers, we just send the window to the same workspace. */
if (con_is_floating(target)) { if (con_is_floating(target)) {
DLOG("target container is floating, moving container to target's workspace.\n"); DLOG("target container is floating, moving container to target's workspace.\n");

View File

@ -24,6 +24,7 @@ use i3test;
my ($A, $B, $S, $M, $F, $source_ws, $target_ws, $ws); my ($A, $B, $S, $M, $F, $source_ws, $target_ws, $ws);
my ($nodes, $focus); my ($nodes, $focus);
my $__i3_scratch;
my $cmd_result; my $cmd_result;
my $_NET_WM_STATE_REMOVE = 0; 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($nodes->[0]->{window}, $M->{id}, 'M remains the first window');
is(@{get_ws($target_ws)->{floating_nodes}}, 1, 'target workspace has the floating container'); 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; done_testing;