aboutsummaryrefslogtreecommitdiff
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index f02f370b..54d611f2 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -623,6 +623,22 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) {
json_object_object_add(json, "colors", colors);
+ if (bar->bindings->length > 0) {
+ json_object *bindings = json_object_new_array();
+ for (int i = 0; i < bar->bindings->length; ++i) {
+ struct bar_binding *binding = bar->bindings->items[i];
+ json_object *bind = json_object_new_object();
+ json_object_object_add(bind, "input_code",
+ json_object_new_int(binding->button));
+ json_object_object_add(bind, "command",
+ json_object_new_string(binding->command));
+ json_object_object_add(bind, "release",
+ json_object_new_boolean(binding->release));
+ json_object_array_add(bindings, bind);
+ }
+ json_object_object_add(json, "bindings", bindings);
+ }
+
// Add outputs if defined
if (bar->outputs && bar->outputs->length > 0) {
json_object *outputs = json_object_new_array();