2 # vim:ts=4:sw=4:expandtab
3 # !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3
5 # Regression: Checks if focus is stolen when a window is managed which is
6 # assigned to an invisible workspace
10 use X11::XCB::Connection;
13 my $x = X11::XCB::Connection->new;
15 # TODO: move to X11::XCB
17 my ($id, $class, $instance) = @_;
19 # Add a _NET_WM_STRUT_PARTIAL hint
20 my $atomname = $x->atom(name => 'WM_CLASS');
21 my $atomtype = $x->atom(name => 'STRING');
29 length($class) + length($instance) + 2,
30 "$instance\x00$class\x00"
35 #####################################################################
36 # start a window and see that it does not get assigned with an empty config
37 #####################################################################
41 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
42 assign "special" → targetws
45 my $pid = launch_with_config($config);
47 my $tmp = fresh_workspace;
49 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
50 ok(get_ws($tmp)->{focused}, 'current workspace focused');
52 my $window = $x->root->create_child(
53 class => WINDOW_CLASS_INPUT_OUTPUT,
54 rect => [ 0, 0, 30, 30 ],
55 background_color => '#0000ff',
59 set_wm_class($window->id, 'special', 'special');
60 $window->name('special window');
65 ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
66 ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
67 ok(get_ws($tmp)->{focused}, 'current workspace still focused');
69 #####################################################################
70 # the same test, but with a floating window
71 #####################################################################
73 $window = $x->root->create_child(
74 class => WINDOW_CLASS_INPUT_OUTPUT,
75 rect => [ 0, 0, 30, 30 ],
76 background_color => '#0000ff',
77 window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
81 set_wm_class($window->id, 'special', 'special');
82 $window->name('special window');
87 ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
88 ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
89 ok(get_ws($tmp)->{focused}, 'current workspace still focused');
91 exit_gracefully($pid);