From 7a934b94dd62bd05d2df59518d66410ccbac1492 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 12 Oct 2011 23:26:04 +0100 Subject: [PATCH] Add TYPE_GET_MARKS and accompanying sugar method --- lib/AnyEvent/I3.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/AnyEvent/I3.pm b/lib/AnyEvent/I3.pm index 3977e652..4a5e8c24 100644 --- a/lib/AnyEvent/I3.pm +++ b/lib/AnyEvent/I3.pm @@ -66,9 +66,11 @@ use constant TYPE_SUBSCRIBE => 2; use constant TYPE_GET_OUTPUTS => 3; use constant TYPE_GET_TREE => 4; use constant TYPE_GET_MARKS => 5; +use constant TYPE_GET_BAR_CONFIG => 6; our %EXPORT_TAGS = ( 'all' => [ - qw(i3 TYPE_COMMAND TYPE_GET_WORKSPACES TYPE_SUBSCRIBE TYPE_GET_OUTPUTS TYPE_GET_TREE TYPE_GET_MARKS) + qw(i3 TYPE_COMMAND TYPE_GET_WORKSPACES TYPE_SUBSCRIBE TYPE_GET_OUTPUTS + TYPE_GET_TREE TYPE_GET_MARKS TYPE_GET_BAR_CONFIG) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{all} } ); @@ -356,6 +358,22 @@ sub get_marks { $self->message(TYPE_GET_MARKS) } +=head2 get_bar_config + +Gets the bar configuration for the specific bar id from i3 (>= v4.1). + + my $config = i3->get_bar_config($id)->recv; + say Dumper($config); + +=cut +sub get_bar_config { + my ($self, $id) = @_; + + $self->_ensure_connection; + + $self->message(TYPE_GET_BAR_CONFIG, $id) +} + =head2 command($content) Makes i3 execute the given command