Implement dock mode, update testsuite

Currently, dock clients are only possible at the top.
This commit is contained in:
Michael Stapelberg
2011-02-20 23:43:03 +01:00
parent 481ae6ccf2
commit 7f89c71689
15 changed files with 269 additions and 73 deletions

View File

@ -18,7 +18,15 @@ sub fullscreen_windows {
# get the output of this workspace
my $tree = $i3->get_tree->recv;
my @outputs = @{$tree->{nodes}};
my $output = first { defined(first { $_->{name} eq $tmp } @{$_->{nodes}}) } @outputs;
my $output;
for my $o (@outputs) {
# get the first CT_CON of each output
my $content = first { $_->{type} == 2 } @{$o->{nodes}};
if (defined(first { $_->{name} eq $tmp } @{$content->{nodes}})) {
$output = $o;
last;
}
}
BEGIN {
use_ok('X11::XCB::Window');

View File

@ -3,6 +3,7 @@
use i3test tests => 7;
use List::MoreUtils qw(all none);
use List::Util qw(first);
my $i3 = i3("/tmp/nestedcons");
@ -41,8 +42,9 @@ ok((all { $_->{type} == 1 } @nodes), 'all nodes are of type CT_OUTPUT');
ok((none { defined($_->{window}) } @nodes), 'no CT_OUTPUT contains a window');
ok((all { @{$_->{nodes}} > 0 } @nodes), 'all nodes have at least one leaf (workspace)');
my @workspaces;
for my $ws (map { @{$_->{nodes}} } @nodes) {
push @workspaces, $ws;
for my $ws (@nodes) {
my $content = first { $_->{type} == 2 } @{$ws->{nodes}};
@workspaces = (@workspaces, @{$content->{nodes}});
}
ok((all { $_->{type} == 4 } @workspaces), 'all workspaces are of type CT_WORKSPACE');

View File

@ -65,10 +65,15 @@ sub open_empty_con {
sub get_workspace_names {
my $i3 = i3("/tmp/nestedcons");
# TODO: use correct command as soon as AnyEvent::i3 is updated
my $tree = $i3->get_tree->recv;
my @workspaces = map { @{$_->{nodes}} } @{$tree->{nodes}};
[ map { $_->{name} } @workspaces ]
my @outputs = @{$tree->{nodes}};
my @cons;
for my $output (@outputs) {
# get the first CT_CON of each output
my $content = first { $_->{type} == 2 } @{$output->{nodes}};
@cons = (@cons, @{$content->{nodes}});
}
[ map { $_->{name} } @cons ]
}
sub get_unused_workspace {
@ -82,11 +87,18 @@ sub get_ws {
my ($name) = @_;
my $i3 = i3("/tmp/nestedcons");
my $tree = $i3->get_tree->recv;
my @ws = map { @{$_->{nodes}} } @{$tree->{nodes}};
my @outputs = @{$tree->{nodes}};
my @workspaces;
for my $output (@outputs) {
# get the first CT_CON of each output
my $content = first { $_->{type} == 2 } @{$output->{nodes}};
@workspaces = (@workspaces, @{$content->{nodes}});
}
# as there can only be one workspace with this name, we can safely
# return the first entry
return first { $_->{name} eq $name } @ws;
return first { $_->{name} eq $name } @workspaces;
}
#
@ -102,12 +114,7 @@ sub get_ws_content {
sub get_focused {
my ($ws) = @_;
my $i3 = i3("/tmp/nestedcons");
my $tree = $i3->get_tree->recv;
my @ws = map { @{$_->{nodes}} } @{$tree->{nodes}};
my @cons = grep { $_->{name} eq $ws } @ws;
my $con = $cons[0];
my $con = get_ws($ws);
my @focused = @{$con->{focus}};
my $lf;