2011-05-16 15:45:30 -04:00
|
|
|
|
#!perl
|
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
|
#
|
2012-09-10 08:09:01 -04:00
|
|
|
|
# Please read the following documents before working on tests:
|
|
|
|
|
# • http://build.i3wm.org/docs/testsuite.html
|
|
|
|
|
# (or docs/testsuite)
|
|
|
|
|
#
|
|
|
|
|
# • http://build.i3wm.org/docs/lib-i3test.html
|
|
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
|
#
|
|
|
|
|
# • http://build.i3wm.org/docs/ipc.html
|
|
|
|
|
# (or docs/ipc)
|
|
|
|
|
#
|
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
|
#
|
2011-11-25 11:39:19 -05:00
|
|
|
|
use i3test i3_autostart => 0;
|
2011-11-23 11:22:43 -05:00
|
|
|
|
use X11::XCB qw(PROP_MODE_REPLACE);
|
2011-05-16 15:45:30 -04:00
|
|
|
|
|
2015-06-29 17:58:48 -04:00
|
|
|
|
my (@nodes);
|
|
|
|
|
|
2011-05-16 15:45:30 -04:00
|
|
|
|
##############################################################
|
|
|
|
|
# 1: test the following directive:
|
|
|
|
|
# for_window [class="borderless"] border none
|
|
|
|
|
# by first creating a window with a different class (should get
|
|
|
|
|
# the normal border), then creating a window with the class
|
|
|
|
|
# "borderless" (should get no border)
|
|
|
|
|
##############################################################
|
|
|
|
|
|
2011-08-02 18:03:13 -04:00
|
|
|
|
my $config = <<EOT;
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [class="borderless"] border none
|
|
|
|
|
for_window [title="special borderless title"] border none
|
|
|
|
|
EOT
|
2011-08-02 13:21:09 -04:00
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
my $pid = launch_with_config($config);
|
2011-08-02 13:21:09 -04:00
|
|
|
|
|
|
|
|
|
my $tmp = fresh_workspace;
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
my $window = open_window(name => 'Border window');
|
2011-05-16 15:45:30 -04:00
|
|
|
|
|
|
|
|
|
my @content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'normal', 'normal border');
|
|
|
|
|
|
|
|
|
|
$window->unmap;
|
2011-11-21 17:44:20 -05:00
|
|
|
|
wait_for_unmap $window;
|
2011-05-16 15:45:30 -04:00
|
|
|
|
|
2011-11-21 15:04:00 -05:00
|
|
|
|
@content = @{get_ws_content($tmp)};
|
2011-05-16 15:45:30 -04:00
|
|
|
|
cmp_ok(@content, '==', 0, 'no more nodes');
|
|
|
|
|
diag('content = '. Dumper(\@content));
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
$window = open_window(
|
|
|
|
|
name => 'Borderless window',
|
2013-09-24 15:53:48 -04:00
|
|
|
|
wm_class => 'borderless',
|
2011-11-23 11:22:43 -05:00
|
|
|
|
);
|
2011-05-16 15:45:30 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'none', 'no border');
|
|
|
|
|
|
|
|
|
|
$window->unmap;
|
2011-11-21 17:44:20 -05:00
|
|
|
|
wait_for_unmap $window;
|
2011-05-16 15:45:30 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 0, 'no more nodes');
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-02 13:21:09 -04:00
|
|
|
|
|
2011-05-16 15:45:30 -04:00
|
|
|
|
##############################################################
|
|
|
|
|
# 2: match on the title, check if for_window is really executed
|
|
|
|
|
# only once
|
|
|
|
|
##############################################################
|
|
|
|
|
|
2011-08-02 18:03:13 -04:00
|
|
|
|
$config = <<EOT;
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [class="borderless"] border none
|
|
|
|
|
for_window [title="special borderless title"] border none
|
|
|
|
|
EOT
|
2011-08-02 13:21:09 -04:00
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-08-02 13:21:09 -04:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
$window = open_window(name => 'special title');
|
2011-05-16 15:45:30 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'normal', 'normal border');
|
|
|
|
|
|
|
|
|
|
$window->name('special borderless title');
|
2011-11-21 19:13:37 -05:00
|
|
|
|
sync_with_i3;
|
2011-05-16 15:45:30 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
is($content[0]->{border}, 'none', 'no border');
|
|
|
|
|
|
|
|
|
|
$window->name('special title');
|
2011-11-21 19:13:37 -05:00
|
|
|
|
sync_with_i3;
|
2011-05-16 15:45:30 -04:00
|
|
|
|
|
|
|
|
|
cmd 'border normal';
|
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
is($content[0]->{border}, 'normal', 'border reset to normal');
|
|
|
|
|
|
|
|
|
|
$window->name('special borderless title');
|
2011-11-21 19:13:37 -05:00
|
|
|
|
sync_with_i3;
|
2011-05-16 15:45:30 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
is($content[0]->{border}, 'normal', 'still normal border');
|
|
|
|
|
|
2011-05-16 16:03:07 -04:00
|
|
|
|
$window->unmap;
|
2011-11-21 17:44:20 -05:00
|
|
|
|
wait_for_unmap $window;
|
2011-05-16 16:03:07 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 0, 'no more nodes');
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-02 13:21:09 -04:00
|
|
|
|
|
2011-05-16 16:03:07 -04:00
|
|
|
|
##############################################################
|
|
|
|
|
# 3: match on the title, set border style *and* a mark
|
|
|
|
|
##############################################################
|
|
|
|
|
|
2011-08-02 18:03:13 -04:00
|
|
|
|
$config = <<EOT;
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [class="borderless" title="usethis"] border none
|
|
|
|
|
for_window [class="borderless"] border none
|
|
|
|
|
for_window [title="special borderless title"] border none
|
|
|
|
|
for_window [title="special mark title"] border none, mark bleh
|
|
|
|
|
EOT
|
2011-08-02 13:21:09 -04:00
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-08-02 13:21:09 -04:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
$window = open_window(name => 'special mark title');
|
2011-05-16 16:03:07 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'none', 'no border');
|
|
|
|
|
|
2011-11-21 18:47:32 -05:00
|
|
|
|
my $other = open_window;
|
2011-05-16 16:03:07 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 2, 'two nodes');
|
|
|
|
|
is($content[0]->{border}, 'none', 'no border');
|
|
|
|
|
is($content[1]->{border}, 'normal', 'normal border');
|
|
|
|
|
ok(!$content[0]->{focused}, 'first one not focused');
|
|
|
|
|
|
|
|
|
|
cmd qq|[con_mark="bleh"] focus|;
|
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
ok($content[0]->{focused}, 'first node focused');
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-02 13:37:04 -04:00
|
|
|
|
|
|
|
|
|
##############################################################
|
|
|
|
|
# 4: multiple criteria for the for_window command
|
|
|
|
|
##############################################################
|
|
|
|
|
|
2011-08-02 18:03:13 -04:00
|
|
|
|
$config = <<EOT;
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [class="borderless" title="usethis"] border none
|
|
|
|
|
EOT
|
2011-08-02 13:37:04 -04:00
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-08-02 13:37:04 -04:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
$window = open_window(
|
|
|
|
|
name => 'usethis',
|
2013-09-24 15:53:48 -04:00
|
|
|
|
wm_class => 'borderless',
|
2011-08-02 13:37:04 -04:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'none', 'no border');
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
cmd 'kill';
|
2011-11-21 17:44:20 -05:00
|
|
|
|
wait_for_unmap $window;
|
2011-10-04 18:34:23 -04:00
|
|
|
|
$window->destroy;
|
2011-08-02 13:37:04 -04:00
|
|
|
|
|
2011-11-21 10:49:22 -05:00
|
|
|
|
# give i3 a chance to delete the window from its tree
|
2011-11-21 19:13:37 -05:00
|
|
|
|
sync_with_i3;
|
2011-11-21 10:49:22 -05:00
|
|
|
|
|
2011-08-02 13:37:04 -04:00
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
$window->_create;
|
2013-09-24 15:53:48 -04:00
|
|
|
|
$window->wm_class('borderless');
|
2011-08-02 13:37:04 -04:00
|
|
|
|
$window->name('notthis');
|
|
|
|
|
$window->map;
|
2011-11-21 17:44:20 -05:00
|
|
|
|
wait_for_map $window;
|
2011-08-02 13:37:04 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'normal', 'no border');
|
|
|
|
|
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-04 14:11:01 -04:00
|
|
|
|
|
|
|
|
|
##############################################################
|
|
|
|
|
# 5: check that a class criterion does not match the instance
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
$config = <<EOT;
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [class="foo"] border 1pixel
|
|
|
|
|
EOT
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-08-04 14:11:01 -04:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
$window = open_window(
|
|
|
|
|
name => 'usethis',
|
2013-09-24 15:53:48 -04:00
|
|
|
|
wm_class => 'bar',
|
|
|
|
|
instance => 'foo',
|
2011-11-23 11:22:43 -05:00
|
|
|
|
);
|
2011-08-04 14:11:01 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'normal', 'normal border, not matched');
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-04 14:11:01 -04:00
|
|
|
|
|
|
|
|
|
##############################################################
|
|
|
|
|
# 6: check that the 'instance' criterion works
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
$config = <<EOT;
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [class="foo"] border 1pixel
|
|
|
|
|
for_window [instance="foo"] border none
|
|
|
|
|
EOT
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-08-04 14:11:01 -04:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
$window = open_window(
|
|
|
|
|
name => 'usethis',
|
2013-09-24 15:53:48 -04:00
|
|
|
|
wm_class => 'bar',
|
|
|
|
|
instance => 'foo',
|
2011-08-04 14:11:01 -04:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'none', 'no border');
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-02 13:21:09 -04:00
|
|
|
|
|
2011-09-11 17:51:59 -04:00
|
|
|
|
##############################################################
|
|
|
|
|
# 7: check that invalid criteria don’t end up matching all windows
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
# this configuration is broken because "asdf" is not a valid integer
|
|
|
|
|
# the for_window should therefore recognize this error and don’t add the
|
|
|
|
|
# assignment
|
|
|
|
|
$config = <<EOT;
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [id="asdf"] border none
|
|
|
|
|
EOT
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-09-11 17:51:59 -04:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
$window = open_window(
|
|
|
|
|
name => 'usethis',
|
2013-09-24 15:53:48 -04:00
|
|
|
|
wm_class => 'bar',
|
|
|
|
|
instance => 'foo',
|
2011-09-11 17:51:59 -04:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'normal', 'normal border');
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
exit_gracefully($pid);
|
2011-09-11 17:51:59 -04:00
|
|
|
|
|
2011-09-18 11:05:54 -04:00
|
|
|
|
##############################################################
|
|
|
|
|
# 8: check that the role criterion works properly
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
$config = <<EOT;
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [window_role="i3test"] border none
|
|
|
|
|
EOT
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-09-18 11:05:54 -04:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
$window = open_window(
|
|
|
|
|
name => 'usethis',
|
|
|
|
|
before_map => sub {
|
|
|
|
|
my ($window) = @_;
|
|
|
|
|
my $atomname = $x->atom(name => 'WM_WINDOW_ROLE');
|
|
|
|
|
my $atomtype = $x->atom(name => 'STRING');
|
|
|
|
|
$x->change_property(
|
|
|
|
|
PROP_MODE_REPLACE,
|
|
|
|
|
$window->id,
|
|
|
|
|
$atomname->id,
|
|
|
|
|
$atomtype->id,
|
|
|
|
|
8,
|
|
|
|
|
length("i3test") + 1,
|
|
|
|
|
"i3test\x00"
|
|
|
|
|
);
|
|
|
|
|
},
|
2011-09-18 11:05:54 -04:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'none', 'no border (window_role)');
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
exit_gracefully($pid);
|
2011-09-18 11:05:54 -04:00
|
|
|
|
|
|
|
|
|
##############################################################
|
|
|
|
|
# 9: another test for the window_role, but this time it changes
|
|
|
|
|
# *after* the window has been mapped
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
$config = <<EOT;
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [window_role="i3test"] border none
|
|
|
|
|
EOT
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-09-18 11:05:54 -04:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
$window = open_window(name => 'usethis');
|
2011-09-18 11:05:54 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'normal', 'normal border (window_role 2)');
|
|
|
|
|
|
2011-11-23 11:22:43 -05:00
|
|
|
|
my $atomname = $x->atom(name => 'WM_WINDOW_ROLE');
|
|
|
|
|
my $atomtype = $x->atom(name => 'STRING');
|
2011-09-18 11:05:54 -04:00
|
|
|
|
$x->change_property(
|
|
|
|
|
PROP_MODE_REPLACE,
|
|
|
|
|
$window->id,
|
|
|
|
|
$atomname->id,
|
|
|
|
|
$atomtype->id,
|
|
|
|
|
8,
|
|
|
|
|
length("i3test") + 1,
|
|
|
|
|
"i3test\x00"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$x->flush;
|
|
|
|
|
|
2011-11-21 19:13:37 -05:00
|
|
|
|
sync_with_i3;
|
2011-09-18 11:05:54 -04:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
|
|
|
|
is($content[0]->{border}, 'none', 'no border (window_role 2)');
|
|
|
|
|
|
2011-10-04 18:34:23 -04:00
|
|
|
|
exit_gracefully($pid);
|
2011-09-18 11:05:54 -04:00
|
|
|
|
|
2015-04-18 16:02:03 -04:00
|
|
|
|
##############################################################
|
|
|
|
|
# 10: check that the criterion 'window_type' works
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
# test all window types
|
|
|
|
|
my %window_types = (
|
|
|
|
|
'normal' => '_NET_WM_WINDOW_TYPE_NORMAL',
|
|
|
|
|
'dialog' => '_NET_WM_WINDOW_TYPE_DIALOG',
|
|
|
|
|
'utility' => '_NET_WM_WINDOW_TYPE_UTILITY',
|
|
|
|
|
'toolbar' => '_NET_WM_WINDOW_TYPE_TOOLBAR',
|
|
|
|
|
'splash' => '_NET_WM_WINDOW_TYPE_SPLASH',
|
|
|
|
|
'menu' => '_NET_WM_WINDOW_TYPE_MENU',
|
|
|
|
|
'dropdown_menu' => '_NET_WM_WINDOW_TYPE_DROPDOWN_MENU',
|
|
|
|
|
'popup_menu' => '_NET_WM_WINDOW_TYPE_POPUP_MENU',
|
|
|
|
|
'tooltip' => '_NET_WM_WINDOW_TYPE_TOOLTIP'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
while (my ($window_type, $atom) = each %window_types) {
|
|
|
|
|
|
|
|
|
|
$config = <<"EOT";
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [window_type="$window_type"] floating enable, mark branded
|
|
|
|
|
EOT
|
|
|
|
|
|
|
|
|
|
$pid = launch_with_config($config);
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
|
|
$window = open_window(window_type => $x->atom(name => $atom));
|
|
|
|
|
|
|
|
|
|
my @nodes = @{get_ws($tmp)->{floating_nodes}};
|
|
|
|
|
cmp_ok(@nodes, '==', 1, 'one floating container on this workspace');
|
2015-10-19 12:10:20 -04:00
|
|
|
|
is_deeply($nodes[0]->{nodes}[0]->{marks}, [ 'branded' ], "mark set (window_type = $atom)");
|
2015-04-18 16:02:03 -04:00
|
|
|
|
|
|
|
|
|
exit_gracefully($pid);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-18 18:30:01 -04:00
|
|
|
|
##############################################################
|
|
|
|
|
# 11: check that the criterion 'window_type' works if the
|
|
|
|
|
# _NET_WM_WINDOW_TYPE is changed after managing.
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
while (my ($window_type, $atom) = each %window_types) {
|
|
|
|
|
|
|
|
|
|
$config = <<"EOT";
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [window_type="$window_type"] floating enable, mark branded
|
|
|
|
|
EOT
|
|
|
|
|
|
|
|
|
|
$pid = launch_with_config($config);
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
|
|
$window = open_window();
|
|
|
|
|
|
|
|
|
|
my $atomname = $x->atom(name => '_NET_WM_WINDOW_TYPE');
|
|
|
|
|
my $atomtype = $x->atom(name => 'ATOM');
|
|
|
|
|
$x->change_property(PROP_MODE_REPLACE, $window->id, $atomname->id, $atomtype->id,
|
|
|
|
|
32, 1, pack('L1', $x->atom(name => $atom)->id));
|
|
|
|
|
$x->flush;
|
|
|
|
|
sync_with_i3;
|
|
|
|
|
|
|
|
|
|
my @nodes = @{get_ws($tmp)->{floating_nodes}};
|
|
|
|
|
cmp_ok(@nodes, '==', 1, 'one floating container on this workspace');
|
2015-10-19 12:10:20 -04:00
|
|
|
|
is_deeply($nodes[0]->{nodes}[0]->{marks}, [ 'branded' ], "mark set (window_type = $atom)");
|
2015-04-18 18:30:01 -04:00
|
|
|
|
|
|
|
|
|
exit_gracefully($pid);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-29 17:58:48 -04:00
|
|
|
|
##############################################################
|
|
|
|
|
# 12: check that the criterion 'workspace' works
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
$config = <<"EOT";
|
|
|
|
|
# i3 config file (v4)
|
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
for_window [workspace="trigger"] floating enable, mark triggered
|
|
|
|
|
EOT
|
|
|
|
|
|
|
|
|
|
$pid = launch_with_config($config);
|
|
|
|
|
|
|
|
|
|
cmd 'workspace trigger';
|
|
|
|
|
$window = open_window;
|
|
|
|
|
|
|
|
|
|
@nodes = @{get_ws('trigger')->{floating_nodes}};
|
|
|
|
|
cmp_ok(@nodes, '==', 1, 'one floating container on this workspace');
|
2015-10-19 12:10:20 -04:00
|
|
|
|
is_deeply($nodes[0]->{nodes}[0]->{marks}, [ 'triggered' ], "mark set for workspace criterion");
|
2015-06-29 17:58:48 -04:00
|
|
|
|
|
|
|
|
|
exit_gracefully($pid);
|
|
|
|
|
|
2015-04-18 16:02:03 -04:00
|
|
|
|
##############################################################
|
2011-09-11 17:51:59 -04:00
|
|
|
|
|
2011-05-16 15:45:30 -04:00
|
|
|
|
done_testing;
|