introduce get_tree request (tree branch only)

This commit is contained in:
Michael Stapelberg 2010-11-21 21:52:43 +01:00
parent a3a42f30e1
commit 7176a7074b
1 changed files with 21 additions and 3 deletions

View File

@ -15,11 +15,11 @@ AnyEvent::I3 - communicate with the i3 window manager
=cut =cut
our $VERSION = '0.06'; our $VERSION = '0.07';
=head1 VERSION =head1 VERSION
Version 0.06 Version 0.07
=head1 SYNOPSIS =head1 SYNOPSIS
@ -64,9 +64,10 @@ use constant TYPE_COMMAND => 0;
use constant TYPE_GET_WORKSPACES => 1; use constant TYPE_GET_WORKSPACES => 1;
use constant TYPE_SUBSCRIBE => 2; use constant TYPE_SUBSCRIBE => 2;
use constant TYPE_GET_OUTPUTS => 3; use constant TYPE_GET_OUTPUTS => 3;
use constant TYPE_GET_TREE => 4;
our %EXPORT_TAGS = ( 'all' => [ our %EXPORT_TAGS = ( 'all' => [
qw(i3 TYPE_COMMAND TYPE_GET_WORKSPACES TYPE_SUBSCRIBE TYPE_GET_OUTPUTS) qw(i3 TYPE_COMMAND TYPE_GET_WORKSPACES TYPE_SUBSCRIBE TYPE_GET_OUTPUTS TYPE_GET_TREE)
] ); ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{all} } ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{all} } );
@ -322,6 +323,23 @@ sub get_outputs {
$self->message(TYPE_GET_OUTPUTS) $self->message(TYPE_GET_OUTPUTS)
} }
=head2 get_tree
Gets the layout tree from i3 (tree branch only).
my $tree = i3->get_tree->recv;
say Dumper($tree);
=cut
sub get_tree {
my ($self) = @_;
$self->_ensure_connection;
$self->message(TYPE_GET_TREE)
}
=head2 command($content) =head2 command($content)
Makes i3 execute the given command Makes i3 execute the given command