force_display_urgency_hint 0ms
EOT
-my $type;
+my ($type, $tmp, $w1, $w2);
for ($type = 1; $type <= 2; $type++) {
my $pid = launch_with_config($config);
- my $tmp = fresh_workspace;
+ $tmp = fresh_workspace;
#####################################################################
# Create two windows and put them in stacking mode
my $ws1 = fresh_workspace;
my $ws2 = fresh_workspace;
cmd "workspace $ws1";
- my $w1 = open_window;
- my $w2 = open_window;
+ $w1 = open_window;
+ $w2 = open_window;
cmd "workspace $ws2";
sync_with_i3;
set_urgency($w1, 1, $type);
##############################################################################
# Check if urgent flag can be unset if we move the window out of the container
##############################################################################
- my $tmp = fresh_workspace;
+ $tmp = fresh_workspace;
cmd 'layout tabbed';
- my $w1 = open_window;
- my $w2 = open_window;
+ $w1 = open_window;
+ $w2 = open_window;
sync_with_i3;
cmd '[id="' . $w2->id . '"] focus';
sync_with_i3;
my $tmp_target = fresh_workspace;
cmd 'workspace ' . $tmp_source;
sync_with_i3;
- my $w1 = open_window;
- my $w2 = open_window;
+ $w1 = open_window;
+ $w2 = open_window;
sync_with_i3;
cmd '[id="' . $w1->id . '"] focus';
sync_with_i3;
# Tests resizing tiling containers
use i3test;
+my ($left, $right);
my $tmp = fresh_workspace;
cmd 'split v';
$tmp = fresh_workspace;
-my $left = open_window;
-my $right = open_window;
+$left = open_window;
+$right = open_window;
cmd 'split v';
$tmp = fresh_workspace;
-my $left = open_floating_window;
-my $right = open_floating_window;
+$left = open_floating_window;
+$right = open_floating_window;
sub get_floating_rect {
my ($window_id) = @_;
# this should bring up window 1
cmd 'scratchpad show';
- my $ws = get_ws($first);
+ $ws = get_ws($first);
is(scalar @{$ws->{floating_nodes}}, 1, 'one floating node on ws1');
is($x->input_focus, $window1->id, "showed the correct scratchpad window1");
use i3test;
use List::Util qw(first);
+my ($con, $first, $second);
+
sub get_marks {
return i3(get_socket_path())->get_marks->recv;
}
# check that only the latter is marked
##############################################################
-my $first = open_window;
-my $second = open_window;
+$first = open_window;
+$second = open_window;
cmd 'mark important';
cmd 'focus left';
# 5: mark a con, toggle the mark, check that the mark is gone
##############################################################
-my $con = open_window;
+$con = open_window;
cmd 'mark important';
cmd 'mark --toggle important';
ok(!get_mark_for_window_on_workspace($tmp, $con), 'container no longer has the mark');
# 6: toggle a mark on an unmarked con, check it is marked
##############################################################
-my $con = open_window;
+$con = open_window;
cmd 'mark --toggle important';
is(get_mark_for_window_on_workspace($tmp, $con), 'important', 'container now has the mark');
# with the new mark
##############################################################
-my $con = open_window;
+$con = open_window;
cmd 'mark boring';
cmd 'mark --toggle important';
is(get_mark_for_window_on_workspace($tmp, $con), 'important', 'container has the most recent mark');
# check only the latter has the mark
##############################################################
-my $first = open_window;
-my $second = open_window;
+$first = open_window;
+$second = open_window;
cmd 'mark important';
cmd 'focus left';
# it fails
##############################################################
-my $first = open_window(wm_class => 'iamnotunique');
-my $second = open_window(wm_class => 'iamnotunique');
+$first = open_window(wm_class => 'iamnotunique');
+$second = open_window(wm_class => 'iamnotunique');
my $result = cmd "[instance=iamnotunique] mark important";
$cv = AnyEvent->condvar;
cmd '[id="' . $win->{id} . '"] floating disable';
-my $e = $cv->recv;
+$e = $cv->recv;
isnt($e, 0, 'disabling floating on a container should send an ipc window event');
is($e->{container}->{window}, $win->{id}, 'the event should contain information about the window');
$cv = AnyEvent->condvar;
$win->delete_hint('urgency');
-my $event = $cv->recv;
+$event = $cv->recv;
isnt($event, 0, 'an urgent con should emit the window::urgent event');
is($event->{container}->{window}, $win->{id}, 'the event should contain information about the window');
use i3test i3_autostart => 0;
use File::Temp qw(tempfile);
+my ($cfg, $ret, $out);
+
sub check_config {
my ($config) = @_;
my ($fh, $tmpfile) = tempfile(UNLINK => 1);
# 1: test with a bogus configuration file
################################################################################
-my $cfg = <<EOT;
+$cfg = <<EOT;
# i3 config file (v4)
i_am_an_unknown_config option
EOT
-my ($ret, $out) = check_config($cfg);
+($ret, $out) = check_config($cfg);
is($ret, 1, "exit code == 1");
like($out, qr/ERROR: *CONFIG: *[Ee]xpected.*tokens/, 'bogus config file');
# 2: test with a valid configuration file
################################################################################
-my $cfg = <<EOT;
+$cfg = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
EOT
-my ($ret, $out) = check_config($cfg);
+($ret, $out) = check_config($cfg);
is($ret, 0, "exit code == 0");
is($out, "", 'valid config file');
use i3test i3_autostart => 0;
use List::Util qw(first);
+my ($config, $pid, $first, $second, $ws1, $ws2);
+
sub send_net_active_window {
my ($id) = @_;
# check that the urgent flag is set and focus is not lost.
#####################################################################
-my $config = <<EOT;
+$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_on_window_activation urgent
EOT
-my $pid = launch_with_config($config);
+$pid = launch_with_config($config);
my $ws = fresh_workspace;
-my $first = open_window;
-my $second = open_window;
+$first = open_window;
+$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
# visible, check that the urgent flag is set and focus is not lost.
#####################################################################
-my $config = <<EOT;
+$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_on_window_activation urgent
EOT
-my $pid = launch_with_config($config);
+$pid = launch_with_config($config);
-my $ws1 = fresh_workspace;
-my $first = open_window;
-my $ws2 = fresh_workspace;
-my $second = open_window;
+$ws1 = fresh_workspace;
+$first = open_window;
+$ws2 = fresh_workspace;
+$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
# check that the focus is switched.
#####################################################################
-my $config = <<EOT;
+$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_on_window_activation focus
EOT
-my $pid = launch_with_config($config);
+$pid = launch_with_config($config);
my $ws = fresh_workspace;
-my $first = open_window;
-my $second = open_window;
+$first = open_window;
+$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
# visible, check that the focus switched.
#####################################################################
-my $config = <<EOT;
+$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_on_window_activation focus
EOT
-my $pid = launch_with_config($config);
+$pid = launch_with_config($config);
-my $ws1 = fresh_workspace;
-my $first = open_window;
-my $ws2 = fresh_workspace;
-my $second = open_window;
+$ws1 = fresh_workspace;
+$first = open_window;
+$ws2 = fresh_workspace;
+$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
# check that nothing happens.
#####################################################################
-my $config = <<EOT;
+$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_on_window_activation none
EOT
-my $pid = launch_with_config($config);
+$pid = launch_with_config($config);
my $ws = fresh_workspace;
-my $first = open_window;
-my $second = open_window;
+$first = open_window;
+$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
# visible, check that nothing happens.
#####################################################################
-my $config = <<EOT;
+$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_on_window_activation none
EOT
-my $pid = launch_with_config($config);
+$pid = launch_with_config($config);
-my $ws1 = fresh_workspace;
-my $first = open_window;
-my $ws2 = fresh_workspace;
-my $second = open_window;
+$ws1 = fresh_workspace;
+$first = open_window;
+$ws2 = fresh_workspace;
+$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
# Ticket: #1416
use i3test i3_autostart => 0;
+my ($config, $pid, $ws, $first, $second, $focused);
+
#####################################################################
# 1: open a window and check that it takes focus
#####################################################################
-my $config = <<EOT;
+$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
EOT
-my $pid = launch_with_config($config);
+$pid = launch_with_config($config);
-my $ws = fresh_workspace;
-my $first = open_window;
-my $focused = get_focused($ws);
-my $second = open_window;
+$ws = fresh_workspace;
+$first = open_window;
+$focused = get_focused($ws);
+$second = open_window;
isnt(get_focused($ws), $focused, 'focus has changed');
# it doesn't take focus
#####################################################################
-my $config = <<EOT;
+$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
no_focus [instance=notme]
EOT
-my $pid = launch_with_config($config);
+$pid = launch_with_config($config);
-my $ws = fresh_workspace;
-my $first = open_window;
-my $focused = get_focused($ws);
-my $second = open_window(wm_class => 'notme');
+$ws = fresh_workspace;
+$first = open_window;
+$focused = get_focused($ws);
+$second = open_window(wm_class => 'notme');
is(get_focused($ws), $focused, 'focus has not changed');