2 # vim:ts=4:sw=4:expandtab
4 # Test if new containers get focused when there is a fullscreen container at
5 # the time of launching the new one.
9 my $i3 = i3(get_socket_path());
11 my $tmp = fresh_workspace;
13 #####################################################################
14 # open the left window
15 #####################################################################
17 my $left = open_window({ background_color => '#ff0000' });
19 is($x->input_focus, $left->id, 'left window focused');
21 diag("left = " . $left->id);
23 #####################################################################
24 # Open the right window
25 #####################################################################
27 my $right = open_window({ background_color => '#00ff00' });
29 diag("right = " . $right->id);
31 #####################################################################
32 # Set the right window to fullscreen
33 #####################################################################
34 cmd 'nop setting fullscreen';
37 #####################################################################
39 #####################################################################
41 my $third = open_window({
42 background_color => '#0000ff',
43 name => 'Third window',
51 diag("third = " . $third->id);
53 # move the fullscreen window to a different ws
55 my $tmp2 = get_unused_workspace;
57 cmd "move workspace $tmp2";
59 # verify that the third window has the focus
60 is($x->input_focus, $third->id, 'third window focused');
62 ################################################################################
63 # Ensure that moving a window to a workspace which has a fullscreen window does
64 # not focus it (otherwise the user cannot get out of fullscreen mode anymore).
65 ################################################################################
67 $tmp = fresh_workspace;
69 my $fullscreen_window = open_window;
72 my $nodes = get_ws_content($tmp);
73 is(scalar @$nodes, 1, 'precisely one window');
74 is($nodes->[0]->{focused}, 1, 'fullscreen window focused');
75 my $old_id = $nodes->[0]->{id};
77 $tmp2 = fresh_workspace;
78 my $move_window = open_window;
79 cmd "move workspace $tmp";
83 $nodes = get_ws_content($tmp);
84 is(scalar @$nodes, 2, 'precisely two windows');
85 is($nodes->[0]->{id}, $old_id, 'id unchanged');
86 is($nodes->[0]->{focused}, 1, 'fullscreen window focused');