From 7176a7074b9a1c94b9f22a2532826bd01586cf3d Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 21 Nov 2010 21:52:43 +0100 Subject: [PATCH] introduce get_tree request (tree branch only) --- lib/AnyEvent/I3.pm | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/AnyEvent/I3.pm b/lib/AnyEvent/I3.pm index 61486488..d191241c 100644 --- a/lib/AnyEvent/I3.pm +++ b/lib/AnyEvent/I3.pm @@ -15,11 +15,11 @@ AnyEvent::I3 - communicate with the i3 window manager =cut -our $VERSION = '0.06'; +our $VERSION = '0.07'; =head1 VERSION -Version 0.06 +Version 0.07 =head1 SYNOPSIS @@ -64,9 +64,10 @@ use constant TYPE_COMMAND => 0; use constant TYPE_GET_WORKSPACES => 1; use constant TYPE_SUBSCRIBE => 2; use constant TYPE_GET_OUTPUTS => 3; +use constant TYPE_GET_TREE => 4; 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} } ); @@ -322,6 +323,23 @@ sub 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) Makes i3 execute the given command -- 2.39.5