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
9 use X11::XCB qw(PROP_MODE_REPLACE);
11 # TODO: move to X11::XCB
13 my ($id, $class, $instance) = @_;
15 # Add a _NET_WM_STRUT_PARTIAL hint
16 my $atomname = $x->atom(name => 'WM_CLASS');
17 my $atomtype = $x->atom(name => 'STRING');
25 length($class) + length($instance) + 2,
26 "$instance\x00$class\x00"
32 my $wm_class = delete($args{wm_class}) || 'special';
33 $args{name} //= 'special window';
37 before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
41 #####################################################################
42 # start a window and see that it does not get assigned with an empty config
43 #####################################################################
47 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
48 assign "special" → targetws
51 my $pid = launch_with_config($config);
53 my $tmp = fresh_workspace;
55 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
56 ok(get_ws($tmp)->{focused}, 'current workspace focused');
58 my $window = open_special;
60 ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
61 ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
62 ok(get_ws($tmp)->{focused}, 'current workspace still focused');
64 #####################################################################
65 # the same test, but with a floating window
66 #####################################################################
68 $window = open_special(
69 window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
72 ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
73 ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
74 ok(get_ws($tmp)->{focused}, 'current workspace still focused');
76 exit_gracefully($pid);