2 # vim:ts=4:sw=4:expandtab
4 # Regression: Checks if focus is stolen when a window is managed which is
5 # assigned to an invisible workspace
7 use i3test i3_autostart => 0;
8 use X11::XCB qw(PROP_MODE_REPLACE);
10 # TODO: move to X11::XCB
12 my ($id, $class, $instance) = @_;
14 # Add a _NET_WM_STRUT_PARTIAL hint
15 my $atomname = $x->atom(name => 'WM_CLASS');
16 my $atomtype = $x->atom(name => 'STRING');
24 length($class) + length($instance) + 2,
25 "$instance\x00$class\x00"
31 my $wm_class = delete($args{wm_class}) || 'special';
32 $args{name} //= 'special window';
36 before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
40 #####################################################################
41 # start a window and see that it does not get assigned with an empty config
42 #####################################################################
46 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
47 assign "special" → targetws
50 my $pid = launch_with_config($config);
52 my $tmp = fresh_workspace;
54 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
55 ok(get_ws($tmp)->{focused}, 'current workspace focused');
57 my $window = open_special;
59 ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
60 ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
61 ok(get_ws($tmp)->{focused}, 'current workspace still focused');
63 #####################################################################
64 # the same test, but with a floating window
65 #####################################################################
67 $window = open_special(
68 window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
71 ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
72 ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
73 ok(get_ws($tmp)->{focused}, 'current workspace still focused');
75 exit_gracefully($pid);