my $tmp = fresh_workspace;
-sub fullscreen_windows {
- my $ws = $tmp;
- $ws = shift if @_;
-
- scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($ws)}
-}
-
# get the output of this workspace
my $tree = $i3->get_tree->recv;
my @outputs = @{$tree->{nodes}};
$swindow->fullscreen(1);
sync_with_i3;
-is(fullscreen_windows(), 1, 'amount of fullscreen windows');
+is_num_fullscreen($tmp, 1, 'amount of fullscreen windows');
$window->fullscreen(0);
sync_with_i3;
-is(fullscreen_windows(), 1, 'amount of fullscreen windows');
+is_num_fullscreen($tmp, 1, 'amount of fullscreen windows');
ok($swindow->mapped, 'window mapped after other fullscreen ended');
$swindow->fullscreen(0);
sync_with_i3;
-is(fullscreen_windows(), 0, 'amount of fullscreen windows after disabling');
+is_num_fullscreen($tmp, 0, 'amount of fullscreen windows after disabling');
cmd 'fullscreen';
-is(fullscreen_windows(), 1, 'amount of fullscreen windows after fullscreen command');
+is_num_fullscreen($tmp, 1, 'amount of fullscreen windows after fullscreen command');
cmd 'fullscreen';
-is(fullscreen_windows(), 0, 'amount of fullscreen windows after fullscreen command');
+is_num_fullscreen($tmp, 0, 'amount of fullscreen windows after fullscreen command');
# clean up the workspace so that it will be cleaned when switching away
cmd 'kill' for (@{get_ws_content($tmp)});
cmd 'fullscreen';
-is(fullscreen_windows($tmp2), 1, 'one fullscreen window on second ws');
+is_num_fullscreen($tmp2, 1, 'one fullscreen window on second ws');
cmd "move workspace $tmp";
-is(fullscreen_windows($tmp2), 0, 'no fullscreen windows on second ws');
-is(fullscreen_windows($tmp), 1, 'one fullscreen window on first ws');
+is_num_fullscreen($tmp2, 0, 'no fullscreen windows on second ws');
+is_num_fullscreen($tmp, 1, 'one fullscreen window on first ws');
$swindow->fullscreen(0);
sync_with_i3;
# Verify that $swindow was the one that initially remained fullscreen.
-is(fullscreen_windows($tmp), 0, 'no fullscreen windows on first ws');
+is_num_fullscreen($tmp, 0, 'no fullscreen windows on first ws');
################################################################################
# Verify that opening a window with _NET_WM_STATE_FULLSCREEN unfullscreens any
cmd "fullscreen";
-is(fullscreen_windows($tmp), 1, 'one fullscreen window on ws');
+is_num_fullscreen($tmp, 1, 'one fullscreen window on ws');
is($x->input_focus, $window->id, 'fullscreen window focused');
$swindow = open_window({
fullscreen => 1
});
-is(fullscreen_windows($tmp), 1, 'one fullscreen window on ws');
+is_num_fullscreen($tmp, 1, 'one fullscreen window on ws');
is($x->input_focus, $swindow->id, 'fullscreen window focused');
################################################################################
$window = open_window;
is($x->input_focus, $window->id, 'window focused');
-is(fullscreen_windows($tmp), 0, 'no fullscreen window on workspace');
+is_num_fullscreen($tmp, 0, 'no fullscreen window on workspace');
cmd 'fullscreen enable';
is($x->input_focus, $window->id, 'window still focused');
-is(fullscreen_windows($tmp), 1, 'one fullscreen window on workspace');
+is_num_fullscreen($tmp, 1, 'one fullscreen window on workspace');
cmd 'fullscreen enable';
is($x->input_focus, $window->id, 'window still focused');
-is(fullscreen_windows($tmp), 1, 'still one fullscreen window on workspace');
+is_num_fullscreen($tmp, 1, 'still one fullscreen window on workspace');
$window->fullscreen(0);
sync_with_i3;
-is(fullscreen_windows($tmp), 0, 'no fullscreen window on workspace');
+is_num_fullscreen($tmp, 0, 'no fullscreen window on workspace');
################################################################################
# Verify that command ‘fullscreen enable global’ works and is idempotent.
$window = open_window;
is($x->input_focus, $window->id, 'window focused');
-is(fullscreen_windows($tmp), 0, 'no fullscreen window on workspace');
+is_num_fullscreen($tmp, 0, 'no fullscreen window on workspace');
cmd 'fullscreen enable global';
is($x->input_focus, $window->id, 'window still focused');
-is(fullscreen_windows($tmp), 1, 'one fullscreen window on workspace');
+is_num_fullscreen($tmp, 1, 'one fullscreen window on workspace');
cmd 'fullscreen enable global';
is($x->input_focus, $window->id, 'window still focused');
-is(fullscreen_windows($tmp), 1, 'still one fullscreen window on workspace');
+is_num_fullscreen($tmp, 1, 'still one fullscreen window on workspace');
$window->fullscreen(0);
sync_with_i3;
-is(fullscreen_windows($tmp), 0, 'no fullscreen window on workspace');
+is_num_fullscreen($tmp, 0, 'no fullscreen window on workspace');
################################################################################
# Verify that command ‘fullscreen disable’ works and is idempotent.
$window = open_window;
is($x->input_focus, $window->id, 'window focused');
-is(fullscreen_windows($tmp), 0, 'no fullscreen window on workspace');
+is_num_fullscreen($tmp, 0, 'no fullscreen window on workspace');
$window->fullscreen(1);
sync_with_i3;
-is(fullscreen_windows($tmp), 1, 'one fullscreen window on workspace');
+is_num_fullscreen($tmp, 1, 'one fullscreen window on workspace');
cmd 'fullscreen disable';
is($x->input_focus, $window->id, 'window still focused');
-is(fullscreen_windows($tmp), 0, 'no fullscreen window on workspace');
+is_num_fullscreen($tmp, 0, 'no fullscreen window on workspace');
cmd 'fullscreen disable';
is($x->input_focus, $window->id, 'window still focused');
-is(fullscreen_windows($tmp), 0, 'still no fullscreen window on workspace');
+is_num_fullscreen($tmp, 0, 'still no fullscreen window on workspace');
################################################################################
# Verify that command ‘fullscreen toggle’ works.
$tmp = fresh_workspace;
$window = open_window;
-is(fullscreen_windows($tmp), 0, 'no fullscreen window on workspace');
+is_num_fullscreen($tmp, 0, 'no fullscreen window on workspace');
cmd 'fullscreen toggle';
is($x->input_focus, $window->id, 'window still focused');
-is(fullscreen_windows($tmp), 1, 'one fullscreen window on workspace');
+is_num_fullscreen($tmp, 1, 'one fullscreen window on workspace');
cmd 'fullscreen toggle';
is($x->input_focus, $window->id, 'window still focused');
-is(fullscreen_windows($tmp), 0, 'no fullscreen window on workspace');
+is_num_fullscreen($tmp, 0, 'no fullscreen window on workspace');
################################################################################
# Verify that a window’s fullscreen is disabled when another one is enabled
$other = open_window;
is($x->input_focus, $other->id, 'other window focused');
-is(fullscreen_windows($tmp), 0, 'no fullscreen window on workspace');
+is_num_fullscreen($tmp, 0, 'no fullscreen window on workspace');
cmd 'fullscreen enable';
is($x->input_focus, $other->id, 'other window focused');
-is(fullscreen_windows($tmp), 1, 'one fullscreen window on workspace');
+is_num_fullscreen($tmp, 1, 'one fullscreen window on workspace');
cmd '[id="' . $window->id . '"] fullscreen enable';
is($x->input_focus, $window->id, 'window focused');
-is(fullscreen_windows($tmp), 1, 'one fullscreen window on workspace');
+is_num_fullscreen($tmp, 1, 'one fullscreen window on workspace');
################################################################################
# Verify that when a global fullscreen is enabled the window is focused and
my $tmp = fresh_workspace;
-sub fullscreen_windows {
- my $ws = $tmp;
- $ws = shift if @_;
-
- my $nodes = scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($ws)->[0]->{nodes}};
- my $cons = scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($ws)};
- return $nodes + $cons;
-}
-
##########################################################################################
# map two windows in one container, fullscreen one of them and then move it to scratchpad
##########################################################################################
cmd 'fullscreen';
# see if the window really is in fullscreen mode
-is(fullscreen_windows(), 1, 'amount of fullscreen windows after enabling fullscreen');
+is_num_fullscreen($tmp, 1, 'amount of fullscreen windows after enabling fullscreen');
# move window to scratchpad
cmd 'move scratchpad';
cmd 'floating toggle';
# see if no window is in fullscreen mode
-is(fullscreen_windows(), 0, 'amount of fullscreen windows after showing previously fullscreened scratchpad window');
+is_num_fullscreen($tmp, 0, 'amount of fullscreen windows after showing previously fullscreened scratchpad window');
########################################################################################
# move a window to scratchpad, focus parent container, make it fullscreen, focus a child
cmd 'focus child';
# see if the window really is in fullscreen mode
-is(fullscreen_windows(), 1, 'amount of fullscreen windows after enabling fullscreen on parent');
+is_num_fullscreen($tmp, 1, 'amount of fullscreen windows after enabling fullscreen on parent');
##########################################################################
# show a scratchpad window; no window should be in fullscreen mode anymore
cmd 'scratchpad show';
# see if no window is in fullscreen mode
-is(fullscreen_windows(), 0, 'amount of fullscreen windows after showing a scratchpad window while a parent container was in fullscreen mode');
+is_num_fullscreen($tmp, 0, 'amount of fullscreen windows after showing a scratchpad window while a parent container was in fullscreen mode');
done_testing;
my @fullscreen_permutations = ([], ["A"], ["B"], ["A", "B"]);
my @urgent;
-sub fullscreen_windows {
- my $ws = shift if @_;
-
- scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($ws)}
-}
-
###############################################################################
# Invalid con_id should not crash i3
# See issue #2895.
$nodes = get_ws_content($ws1);
$node = $nodes->[0];
is($node->{window}, $B->{id}, 'B is on ws1:left');
- is(fullscreen_windows($ws1), $A_fullscreen, 'amount of fullscreen windows in ws1');
+ is_num_fullscreen($ws1, $A_fullscreen, 'amount of fullscreen windows in ws1');
is($node->{fullscreen_mode}, $A_fullscreen, 'B got A\'s fullscreen mode');
$nodes = get_ws_content($ws2);
$node = $nodes->[1];
is($node->{window}, $A->{id}, 'A is on ws2:right');
is(get_focused($ws2), $expected_focus, 'A is focused');
- is(fullscreen_windows($ws2), $B_fullscreen, 'amount of fullscreen windows in ws2');
+ is_num_fullscreen($ws2, $B_fullscreen, 'amount of fullscreen windows in ws2');
is($node->{fullscreen_mode}, $B_fullscreen, 'A got B\'s fullscreen mode');
kill_all_windows;
$nodes = get_ws_content($ws1);
is($nodes->[0]->{window}, $B->{id}, 'B is on ws1:left');
-is(fullscreen_windows($ws1), 1, 'F still fullscreen in ws1');
+is_num_fullscreen($ws1, 1, 'F still fullscreen in ws1');
is(get_focused($ws1), $expected_focus, 'F is still focused');
$nodes = get_ws_content($ws2);
open_window;
cmd "focus parent";
cmd "fullscreen enable";
-$F = fullscreen_windows($ws1);
$expected_focus = get_focused($ws1);
$ws2 = fresh_workspace;
$nodes = get_ws_content($ws1);
is($nodes->[1]->{nodes}->[0]->{window}, $B->{id}, 'B is on top right in ws1');
is(get_focused($ws1), $expected_focus, 'The container of the stacked windows remains focused in ws1');
-is(fullscreen_windows($ws1), $F, 'Same amount of fullscreen windows in ws1');
+is_num_fullscreen($ws1, 1, 'Same amount of fullscreen windows in ws1');
$nodes = get_ws_content($ws2);
is($nodes->[0]->{window}, $A->{id}, 'A is on ws2');
-is(fullscreen_windows($ws2), 1, 'A is in fullscreen mode');
+is_num_fullscreen($ws2, 1, 'A is in fullscreen mode');
###############################################################################
# Swap two non-focused containers within the same workspace.
$nodes = get_ws_content($ws1);
$node = $nodes->[0];
is($node->{window}, $B->{id}, 'B is on the first workspace');
- is(fullscreen_windows($ws1), $A_fullscreen, 'amount of fullscreen windows in ws1');
+ is_num_fullscreen($ws1, $A_fullscreen, 'amount of fullscreen windows in ws1');
is($node->{fullscreen_mode}, $A_fullscreen, 'B got A\'s fullscreen mode');
$nodes = get_ws_content($ws2);
$node = $nodes->[0];
is($node->{window}, $A->{id}, 'A is on the second workspace');
- is(fullscreen_windows($ws2), $B_fullscreen, 'amount of fullscreen windows in ws2');
+ is_num_fullscreen($ws2, $B_fullscreen, 'amount of fullscreen windows in ws2');
is($node->{fullscreen_mode}, $B_fullscreen, 'A got B\'s fullscreen mode');
is(get_focused($ws3), $expected_focus, 'F is still focused');