Implement 'split'

This commit is contained in:
Michael Stapelberg
2010-05-10 09:33:10 +02:00
parent 145ebc7584
commit 6a1c34d2c5
7 changed files with 86 additions and 8 deletions

View File

@ -19,7 +19,7 @@ use AnyEvent::I3;
#use Exporter qw(import);
use base 'Exporter';
our @EXPORT = qw(get_workspace_names get_unused_workspace get_ws_content);
our @EXPORT = qw(get_workspace_names get_unused_workspace get_ws_content get_ws);
BEGIN {
my $window_count = 0;
@ -76,4 +76,14 @@ sub get_ws_content {
return wantarray ? ($cons[0]->{nodes}, $cons[0]->{focus}) : $cons[0]->{nodes};
}
sub get_ws {
my ($name) = @_;
my $i3 = i3("/tmp/nestedcons");
my $tree = $i3->get_workspaces->recv;
my @ws = map { @{$_->{nodes}} } @{$tree->{nodes}};
my @cons = grep { $_->{name} eq $name } @ws;
return $cons[0];
}
1