2011-05-16 21:45:30 +02:00
|
|
|
|
#!perl
|
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
2011-08-02 19:21:09 +02:00
|
|
|
|
# !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3
|
2011-05-16 21:45:30 +02:00
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
use i3test;
|
2011-11-21 21:39:50 +01:00
|
|
|
|
use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT);
|
2011-05-16 21:45:30 +02: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-03 00:03:13 +02: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 19:21:09 +02:00
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
|
my $pid = launch_with_config($config);
|
2011-08-02 19:21:09 +02:00
|
|
|
|
|
|
|
|
|
my $tmp = fresh_workspace;
|
|
|
|
|
|
2011-05-16 21:45:30 +02:00
|
|
|
|
my $window = $x->root->create_child(
|
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
|
rect => [ 0, 0, 30, 30 ],
|
|
|
|
|
background_color => '#00ff00',
|
2011-09-24 14:08:02 +02:00
|
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-05-16 21:45:30 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->name('Border window');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-05-16 21:45:30 +02: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 23:44:20 +01:00
|
|
|
|
wait_for_unmap $window;
|
2011-05-16 21:45:30 +02:00
|
|
|
|
|
2011-11-21 21:04:00 +01:00
|
|
|
|
@content = @{get_ws_content($tmp)};
|
2011-05-16 21:45:30 +02:00
|
|
|
|
cmp_ok(@content, '==', 0, 'no more nodes');
|
|
|
|
|
diag('content = '. Dumper(\@content));
|
|
|
|
|
|
|
|
|
|
$window = $x->root->create_child(
|
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
|
rect => [ 0, 0, 30, 30 ],
|
|
|
|
|
background_color => '#00ff00',
|
2011-09-24 14:08:02 +02:00
|
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-05-16 21:45:30 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->_create;
|
|
|
|
|
|
|
|
|
|
# TODO: move this to X11::XCB::Window
|
|
|
|
|
sub set_wm_class {
|
|
|
|
|
my ($id, $class, $instance) = @_;
|
|
|
|
|
|
|
|
|
|
# Add a _NET_WM_STRUT_PARTIAL hint
|
|
|
|
|
my $atomname = $x->atom(name => 'WM_CLASS');
|
|
|
|
|
my $atomtype = $x->atom(name => 'STRING');
|
|
|
|
|
|
|
|
|
|
$x->change_property(
|
|
|
|
|
PROP_MODE_REPLACE,
|
2011-05-24 22:56:06 +02:00
|
|
|
|
$id,
|
2011-05-16 21:45:30 +02:00
|
|
|
|
$atomname->id,
|
|
|
|
|
$atomtype->id,
|
|
|
|
|
8,
|
|
|
|
|
length($class) + length($instance) + 2,
|
|
|
|
|
"$instance\x00$class\x00"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set_wm_class($window->id, 'borderless', 'borderless');
|
|
|
|
|
$window->name('Borderless window');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-05-16 21:45:30 +02: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 23:44:20 +01:00
|
|
|
|
wait_for_unmap $window;
|
2011-05-16 21:45:30 +02:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 0, 'no more nodes');
|
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-02 19:21:09 +02:00
|
|
|
|
|
2011-05-16 21:45:30 +02:00
|
|
|
|
##############################################################
|
|
|
|
|
# 2: match on the title, check if for_window is really executed
|
|
|
|
|
# only once
|
|
|
|
|
##############################################################
|
|
|
|
|
|
2011-08-03 00:03:13 +02: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 19:21:09 +02:00
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-08-02 19:21:09 +02:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
2011-05-16 21:45:30 +02:00
|
|
|
|
$window = $x->root->create_child(
|
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
|
rect => [ 0, 0, 30, 30 ],
|
|
|
|
|
background_color => '#00ff00',
|
2011-09-24 14:08:02 +02:00
|
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-05-16 21:45:30 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->name('special title');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-05-16 21:45:30 +02: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-22 01:13:37 +01:00
|
|
|
|
sync_with_i3;
|
2011-05-16 21:45:30 +02:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
is($content[0]->{border}, 'none', 'no border');
|
|
|
|
|
|
|
|
|
|
$window->name('special title');
|
2011-11-22 01:13:37 +01:00
|
|
|
|
sync_with_i3;
|
2011-05-16 21:45:30 +02: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-22 01:13:37 +01:00
|
|
|
|
sync_with_i3;
|
2011-05-16 21:45:30 +02:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
is($content[0]->{border}, 'normal', 'still normal border');
|
|
|
|
|
|
2011-05-16 22:03:07 +02:00
|
|
|
|
$window->unmap;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_unmap $window;
|
2011-05-16 22:03:07 +02:00
|
|
|
|
|
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 0, 'no more nodes');
|
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-02 19:21:09 +02:00
|
|
|
|
|
2011-05-16 22:03:07 +02:00
|
|
|
|
##############################################################
|
|
|
|
|
# 3: match on the title, set border style *and* a mark
|
|
|
|
|
##############################################################
|
|
|
|
|
|
2011-08-03 00:03:13 +02: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 19:21:09 +02:00
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-08-02 19:21:09 +02:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
2011-05-16 22:03:07 +02:00
|
|
|
|
$window = $x->root->create_child(
|
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
|
rect => [ 0, 0, 30, 30 ],
|
|
|
|
|
background_color => '#00ff00',
|
2011-09-24 14:08:02 +02:00
|
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-05-16 22:03:07 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->name('special mark title');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-05-16 22:03:07 +02: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-22 00:47:32 +01:00
|
|
|
|
my $other = open_window;
|
2011-05-16 22:03:07 +02: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-05 00:34:23 +02:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-02 19:37:04 +02:00
|
|
|
|
|
|
|
|
|
##############################################################
|
|
|
|
|
# 4: multiple criteria for the for_window command
|
|
|
|
|
##############################################################
|
|
|
|
|
|
2011-08-03 00:03:13 +02: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 19:37:04 +02:00
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-08-02 19:37:04 +02:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
|
|
$window = $x->root->create_child(
|
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
|
rect => [ 0, 0, 30, 30 ],
|
|
|
|
|
background_color => '#00ff00',
|
2011-09-24 14:08:02 +02:00
|
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-08-02 19:37:04 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->_create;
|
|
|
|
|
|
|
|
|
|
set_wm_class($window->id, 'borderless', 'borderless');
|
|
|
|
|
$window->name('usethis');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-08-02 19:37:04 +02: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-05 00:34:23 +02:00
|
|
|
|
cmd 'kill';
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_unmap $window;
|
2011-10-05 00:34:23 +02:00
|
|
|
|
$window->destroy;
|
2011-08-02 19:37:04 +02:00
|
|
|
|
|
2011-11-21 16:49:22 +01:00
|
|
|
|
# give i3 a chance to delete the window from its tree
|
2011-11-22 01:13:37 +01:00
|
|
|
|
sync_with_i3;
|
2011-11-21 16:49:22 +01:00
|
|
|
|
|
2011-08-02 19:37:04 +02:00
|
|
|
|
@content = @{get_ws_content($tmp)};
|
|
|
|
|
cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
|
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
|
$window->_create;
|
|
|
|
|
|
2011-08-02 19:37:04 +02:00
|
|
|
|
set_wm_class($window->id, 'borderless', 'borderless');
|
|
|
|
|
$window->name('notthis');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-08-02 19:37:04 +02: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-05 00:34:23 +02:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-04 20:11:01 +02: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-05 00:34:23 +02:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-08-04 20:11:01 +02:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
|
|
$window = $x->root->create_child(
|
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
|
rect => [ 0, 0, 30, 30 ],
|
|
|
|
|
background_color => '#00ff00',
|
2011-09-24 14:08:02 +02:00
|
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-08-04 20:11:01 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->_create;
|
|
|
|
|
|
|
|
|
|
set_wm_class($window->id, 'bar', 'foo');
|
|
|
|
|
$window->name('usethis');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-08-04 20:11:01 +02: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-05 00:34:23 +02:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-04 20:11:01 +02: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-05 00:34:23 +02:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-08-04 20:11:01 +02:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
|
|
$window = $x->root->create_child(
|
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
|
rect => [ 0, 0, 30, 30 ],
|
|
|
|
|
background_color => '#00ff00',
|
2011-09-24 14:08:02 +02:00
|
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-08-04 20:11:01 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->_create;
|
|
|
|
|
|
|
|
|
|
set_wm_class($window->id, 'bar', 'foo');
|
|
|
|
|
$window->name('usethis');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-08-04 20:11:01 +02: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-05 00:34:23 +02:00
|
|
|
|
exit_gracefully($pid);
|
2011-08-02 19:21:09 +02:00
|
|
|
|
|
2011-09-11 23:51:59 +02: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-05 00:34:23 +02:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-09-11 23:51:59 +02:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
|
|
$window = $x->root->create_child(
|
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
|
rect => [ 0, 0, 30, 30 ],
|
|
|
|
|
background_color => '#00ff00',
|
2011-09-24 14:08:02 +02:00
|
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-09-11 23:51:59 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->_create;
|
|
|
|
|
|
|
|
|
|
set_wm_class($window->id, 'bar', 'foo');
|
|
|
|
|
$window->name('usethis');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-09-11 23:51:59 +02: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-05 00:34:23 +02:00
|
|
|
|
exit_gracefully($pid);
|
2011-09-11 23:51:59 +02:00
|
|
|
|
|
2011-09-18 17:05:54 +02:00
|
|
|
|
##############################################################
|
|
|
|
|
# 8: check that the role criterion works properly
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
# 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 [window_role="i3test"] border none
|
|
|
|
|
EOT
|
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-09-18 17:05:54 +02:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
|
|
$window = $x->root->create_child(
|
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
|
rect => [ 0, 0, 30, 30 ],
|
|
|
|
|
background_color => '#00ff00',
|
2011-09-24 14:08:02 +02:00
|
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-09-18 17:05:54 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->_create;
|
|
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->name('usethis');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-09-18 17:05:54 +02: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-05 00:34:23 +02:00
|
|
|
|
exit_gracefully($pid);
|
2011-09-18 17:05:54 +02:00
|
|
|
|
|
|
|
|
|
##############################################################
|
|
|
|
|
# 9: another test for the window_role, but this time it changes
|
|
|
|
|
# *after* the window has been mapped
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
# 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 [window_role="i3test"] border none
|
|
|
|
|
EOT
|
|
|
|
|
|
2011-10-05 00:34:23 +02:00
|
|
|
|
$pid = launch_with_config($config);
|
2011-09-18 17:05:54 +02:00
|
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
|
|
$window = $x->root->create_child(
|
|
|
|
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
|
|
|
rect => [ 0, 0, 30, 30 ],
|
|
|
|
|
background_color => '#00ff00',
|
2011-09-24 14:08:02 +02:00
|
|
|
|
event_mask => [ 'structure_notify' ],
|
2011-09-18 17:05:54 +02:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$window->_create;
|
|
|
|
|
|
|
|
|
|
$window->name('usethis');
|
|
|
|
|
$window->map;
|
2011-11-21 23:44:20 +01:00
|
|
|
|
wait_for_map $window;
|
2011-09-18 17:05:54 +02: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)');
|
|
|
|
|
|
|
|
|
|
$atomname = $x->atom(name => 'WM_WINDOW_ROLE');
|
|
|
|
|
$atomtype = $x->atom(name => 'STRING');
|
|
|
|
|
$x->change_property(
|
|
|
|
|
PROP_MODE_REPLACE,
|
|
|
|
|
$window->id,
|
|
|
|
|
$atomname->id,
|
|
|
|
|
$atomtype->id,
|
|
|
|
|
8,
|
|
|
|
|
length("i3test") + 1,
|
|
|
|
|
"i3test\x00"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$x->flush;
|
|
|
|
|
|
2011-11-22 01:13:37 +01:00
|
|
|
|
sync_with_i3;
|
2011-09-18 17:05:54 +02: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-05 00:34:23 +02:00
|
|
|
|
exit_gracefully($pid);
|
2011-09-18 17:05:54 +02:00
|
|
|
|
|
2011-09-11 23:51:59 +02:00
|
|
|
|
|
2011-05-16 21:45:30 +02:00
|
|
|
|
done_testing;
|