PREREQ_PM => {
'AnyEvent' => 0,
'AnyEvent::I3' => '0.14',
- 'X11::XCB' => '0.03',
+ 'X11::XCB' => '0.09',
'Inline' => 0,
'ExtUtils::PkgConfig' => 0,
'Test::More' => '0.94',
# Tests all kinds of matching methods
#
use i3test;
-use X11::XCB qw(PROP_MODE_REPLACE);
my $tmp = fresh_workspace;
$tmp = fresh_workspace;
-# TODO: move to X11::XCB
-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,
- $id,
- $atomname->id,
- $atomtype->id,
- 8,
- length($class) + length($instance) + 2,
- "$instance\x00$class\x00"
- );
-}
-
-sub open_special {
- my %args = @_;
- my $wm_class = delete($args{wm_class}) || 'special';
-
- return open_window(
- %args,
- before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
- );
-}
-
-my $left = open_special(name => 'left');
+my $left = open_window(wm_class => 'special', name => 'left');
ok($left->mapped, 'left window mapped');
-my $right = open_special(name => 'right');
+my $right = open_window(wm_class => 'special', name => 'right');
ok($right->mapped, 'right window mapped');
# two windows should be here
$tmp = fresh_workspace;
-$left = open_special(name => 'left', wm_class => 'special7');
+$left = open_window(name => 'left', wm_class => 'special7');
ok($left->mapped, 'left window mapped');
is_num_children($tmp, 1, 'window opened');
$tmp = fresh_workspace;
-$left = open_special(name => 'ä 3', wm_class => 'special7');
+$left = open_window(name => 'ä 3', wm_class => 'special7');
ok($left->mapped, 'left window mapped');
is_num_children($tmp, 1, 'window opened');
cmp_ok(@content, '==', 0, 'no more nodes');
diag('content = '. Dumper(\@content));
-
-# 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,
- $id,
- $atomname->id,
- $atomtype->id,
- 8,
- length($class) + length($instance) + 2,
- "$instance\x00$class\x00"
- );
-}
-
$window = open_window(
name => 'Borderless window',
- before_map => sub { set_wm_class($_->id, 'borderless', 'borderless') },
+ wm_class => 'borderless',
);
@content = @{get_ws_content($tmp)};
$window = open_window(
name => 'usethis',
- before_map => sub { set_wm_class($_->id, 'borderless', 'borderless') },
+ wm_class => 'borderless',
);
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
$window->_create;
-
-set_wm_class($window->id, 'borderless', 'borderless');
+$window->wm_class('borderless');
$window->name('notthis');
$window->map;
wait_for_map $window;
$window = open_window(
name => 'usethis',
- before_map => sub { set_wm_class($_->id, 'bar', 'foo') },
+ wm_class => 'bar',
+ instance => 'foo',
);
@content = @{get_ws_content($tmp)};
$window = open_window(
name => 'usethis',
- before_map => sub { set_wm_class($_->id, 'bar', 'foo') },
+ wm_class => 'bar',
+ instance => 'foo',
);
@content = @{get_ws_content($tmp)};
$window = open_window(
name => 'usethis',
- before_map => sub { set_wm_class($_->id, 'bar', 'foo') },
+ wm_class => 'bar',
+ instance => 'foo',
);
@content = @{get_ws_content($tmp)};
# Tests if assignments work
#
use i3test i3_autostart => 0;
-use X11::XCB qw(PROP_MODE_REPLACE);
-
-# TODO: move to X11::XCB
-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,
- $id,
- $atomname->id,
- $atomtype->id,
- 8,
- length($class) + length($instance) + 2,
- "$instance\x00$class\x00"
- );
-}
sub open_special {
my %args = @_;
- my $wm_class = delete($args{wm_class}) || 'special';
$args{name} //= 'special window';
# We use dont_map because i3 will not map the window on the current
# workspace. Thus, open_window would time out in wait_for_map (2 seconds).
my $window = open_window(
%args,
- before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
+ wm_class => 'special',
dont_map => 1,
);
$window->map;
# assigned to an invisible workspace
#
use i3test i3_autostart => 0;
-use X11::XCB qw(PROP_MODE_REPLACE);
-
-# TODO: move to X11::XCB
-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,
- $id,
- $atomname->id,
- $atomtype->id,
- 8,
- length($class) + length($instance) + 2,
- "$instance\x00$class\x00"
- );
-}
sub open_special {
my %args = @_;
- my $wm_class = delete($args{wm_class}) || 'special';
$args{name} //= 'special window';
# We use dont_map because i3 will not map the window on the current
# workspace. Thus, open_window would time out in wait_for_map (2 seconds).
my $window = open_window(
%args,
- before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
+ wm_class => 'special',
dont_map => 1,
);
$window->map;
# window is shown on another workspace.
#
use i3test;
-use List::Util qw(first);
-use X11::XCB qw(:all);
my $i3 = i3(get_socket_path());
my $tmp = fresh_workspace;
-# TODO: move to X11::XCB
-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,
- $id,
- $atomname->id,
- $atomtype->id,
- 8,
- length($class) + length($instance) + 2,
- "$instance\x00$class\x00"
- );
-}
-
-sub open_special {
- my %args = @_;
- my $wm_class = delete($args{wm_class}) || 'special';
-
- return open_window(
- %args,
- before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
- );
-}
-
my $win = open_window;
-my $scratch = open_special;
+my $scratch = open_window(wm_class => 'special');
cmd '[class="special"] move scratchpad';
is_num_children($tmp, 1, 'one window on current ws');
# Ticket: #909
# Bug still in: 4.4-69-g6856b23
use i3test i3_autostart => 0;
-use X11::XCB qw(:all);
my $config = <<EOT;
# i3 config file (v4)
my $pid = launch_with_config($config);
-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,
- $id,
- $atomname->id,
- $atomtype->id,
- 8,
- length($class) + length($instance) + 2,
- "$instance\x00$class\x00"
- );
-}
-
# We use dont_map because i3 will not map the window on the current
# workspace. Thus, open_window would time out in wait_for_map (2 seconds).
my $window = open_window(
- before_map => sub { set_wm_class($_->id, '__i3-test-window', '__i3-test-window') },
+ wm_class => '__i3-test-window',
dont_map => 1,
);
$window->map;
# Ticket: #913
# Bug still in: 4.4-97-gf767ac3
use i3test;
-use X11::XCB qw(:all);
-
-# TODO: move to X11::XCB
-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,
- $id,
- $atomname->id,
- $atomtype->id,
- 8,
- length($class) + length($instance) + 2,
- "$instance\x00$class\x00"
- );
-}
-
-sub open_special {
- my %args = @_;
- my $wm_class = delete($args{wm_class}) || 'special';
-
- return open_window(
- %args,
- before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
- );
-}
my $tmp = fresh_workspace;
# Open a new window which we can identify later on based on its WM_CLASS.
-my $scratch = open_special;
+my $scratch = open_window(wm_class => 'special');
my $tmp2 = fresh_workspace;
# Ticket: #1027
# Bug still in: 4.5.1-90-g6582da9
use i3test i3_autostart => 0;
-use X11::XCB qw(PROP_MODE_REPLACE);
my $config = <<'EOT';
# i3 config file (v4)
my $pid = launch_with_config($config);
-# 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,
- $id,
- $atomname->id,
- $atomtype->id,
- 8,
- length($class) + length($instance) + 2,
- "$instance\x00$class\x00"
- );
-}
-
my $window = open_window(
name => 'Borderless window',
- before_map => sub { set_wm_class($_->id, 'special', 'special') },
+ wm_class => 'special',
dont_map => 1,
);
$window->map;
# Ticket: #1086
# Bug still in: 4.6-62-g7098ef6
use i3test i3_autostart => 0;
-use X11::XCB qw(:all);
-
-# TODO: move to X11::XCB
-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,
- $id,
- $atomname->id,
- $atomtype->id,
- 8,
- length($class) + length($instance) + 2,
- "$instance\x00$class\x00"
- );
-}
sub open_special {
my %args = @_;
- my $wm_class = delete($args{wm_class}) || 'special';
$args{name} //= 'special window';
# We use dont_map because i3 will not map the window on the current
# workspace. Thus, open_window would time out in wait_for_map (2 seconds).
my $window = open_window(
%args,
- before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
+ wm_class => 'special',
dont_map => 1,
);
$window->add_hint('urgency');