aboutsummaryrefslogtreecommitdiff
path: root/AnyEvent-I3
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2017-08-19 17:29:03 +0200
committerMichael Stapelberg <michael@stapelberg.de>2017-08-19 19:08:51 +0200
commita6d8ed9b1ac6efa507d65b752758522bcfcc5213 (patch)
treeea53000b6f210e1171b9c2fb1903c1e1b084163d /AnyEvent-I3
parent6bb9c9e7088aaf5142b26fb297c86343b02dad76 (diff)
downloadi3-a6d8ed9b1ac6efa507d65b752758522bcfcc5213.tar.gz
i3-a6d8ed9b1ac6efa507d65b752758522bcfcc5213.zip
Introduce the GET_CONFIG IPC request
This introduces memory usage by one copy of the config file, which is an acceptable trade-off for being able to easily revert data loss. The default config is 6KB, user configs will be in the same ballpark. fixes #2856
Diffstat (limited to 'AnyEvent-I3')
-rw-r--r--AnyEvent-I3/lib/AnyEvent/I3.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/AnyEvent-I3/lib/AnyEvent/I3.pm b/AnyEvent-I3/lib/AnyEvent/I3.pm
index 875f3790..5ce3c016 100644
--- a/AnyEvent-I3/lib/AnyEvent/I3.pm
+++ b/AnyEvent-I3/lib/AnyEvent/I3.pm
@@ -95,10 +95,13 @@ use constant TYPE_GET_TREE => 4;
use constant TYPE_GET_MARKS => 5;
use constant TYPE_GET_BAR_CONFIG => 6;
use constant TYPE_GET_VERSION => 7;
+use constant TYPE_GET_BINDING_MODES => 8;
+use constant TYPE_GET_CONFIG => 9;
our %EXPORT_TAGS = ( 'all' => [
qw(i3 TYPE_COMMAND TYPE_GET_WORKSPACES TYPE_SUBSCRIBE TYPE_GET_OUTPUTS
- TYPE_GET_TREE TYPE_GET_MARKS TYPE_GET_BAR_CONFIG TYPE_GET_VERSION)
+ TYPE_GET_TREE TYPE_GET_MARKS TYPE_GET_BAR_CONFIG TYPE_GET_VERSION
+ TYPE_GET_BINDING_MODES TYPE_GET_CONFIG)
] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{all} } );
@@ -501,6 +504,20 @@ sub get_version {
return $cv;
}
+=head2 get_config
+
+Gets the raw last read config from i3. Requires i3 >= 4.14
+
+=cut
+sub get_config {
+ my ($self) = @_;
+
+ $self->_ensure_connection;
+
+ $self->message(TYPE_GET_CONFIG);
+}
+
+
=head2 command($content)
Makes i3 execute the given command