diff --git a/src/cfgparse.y b/src/cfgparse.y index 4b443b89..2258268f 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -692,7 +692,7 @@ assign: if (*workspace == '\0') { /* This assignment was *only* for floating */ assignment->type = A_COMMAND; - assignment->dest.command = sstrdup("mode floating"); + assignment->dest.command = sstrdup("floating enable"); TAILQ_INSERT_TAIL(&assignments, assignment, assignments); break; } else { @@ -700,7 +700,7 @@ assign: Assignment *floating = scalloc(sizeof(Assignment)); match_copy(&(floating->match), match); floating->type = A_COMMAND; - floating->dest.command = sstrdup("mode floating"); + floating->dest.command = sstrdup("floating enable"); TAILQ_INSERT_TAIL(&assignments, floating, assignments); } } diff --git a/testcases/t/66-assign.t b/testcases/t/66-assign.t index 56b90548..84d71930 100644 --- a/testcases/t/66-assign.t +++ b/testcases/t/66-assign.t @@ -162,4 +162,50 @@ ok(@{get_ws_content('targetws')} == 2, 'two containers on targetws'); exit_gracefully($process->pid); +##################################################################### +# start a window and see that it gets assigned to a workspace which has content +# already, next to the existing node. +##################################################################### + +($fh, $tmpfile) = tempfile(); +say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1"; +say $fh "ipc-socket /tmp/nestedcons"; +say $fh q|assign "special" → ~|; +close($fh); + +diag("Starting i3"); +$i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $tmpfile >/dev/null 2>/dev/null"; +$process = Proc::Background->new($i3cmd); +sleep 1; + +diag("pid = " . $process->pid); + +$tmp = fresh_workspace; + +ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); +my $workspaces = get_workspace_names; +ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet'); + +my $window = $x->root->create_child( + class => WINDOW_CLASS_INPUT_OUTPUT, + rect => [ 0, 0, 30, 30 ], + background_color => '#0000ff', +); + +$window->_create; +set_wm_class($window->id, 'special', 'special'); +$window->name('special window'); +$window->map; +sleep 0.25; + +my $content = get_ws($tmp); +ok(@{$content->{nodes}} == 0, 'no tiling cons'); +ok(@{$content->{floating_nodes}} == 1, 'one floating con'); + +$window->destroy; + +exit_gracefully($process->pid); + +sleep 0.25; + done_testing;