diff options
author | Ian Fan <ianfan0@gmail.com> | 2018-09-30 15:09:55 +0100 |
---|---|---|
committer | Ian Fan <ianfan0@gmail.com> | 2018-10-14 13:33:12 +0100 |
commit | a67fa8a05d010d488b821a7d6e91db5905f7a123 (patch) | |
tree | 875e687c2c707663f63c39683a828a9e21be2711 /swaybar | |
parent | 18eaf452245d47461070894b4324d2afa47b0b05 (diff) | |
download | sway-a67fa8a05d010d488b821a7d6e91db5905f7a123.tar.xz |
swaybar: only subscribe to required events
This adds barconfig_update to the list of subscribed events, as well as
checking when the other events need to be subscribed to.
Diffstat (limited to 'swaybar')
-rw-r--r-- | swaybar/ipc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/swaybar/ipc.c b/swaybar/ipc.c index 84046ab5..26b7eca6 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c @@ -356,8 +356,12 @@ bool ipc_initialize(struct swaybar *bar) { free(res); ipc_get_outputs(bar); - const char *subscribe = "[ \"workspace\", \"mode\" ]"; - len = strlen(subscribe); + struct swaybar_config *config = bar->config; + char subscribe[128]; // suitably large buffer + len = snprintf(subscribe, 128, + "[ \"barconfig_update\" %s %s ]", + config->binding_mode_indicator ? ", \"mode\"" : "", + config->workspace_buttons ? ", \"workspace\"" : ""); free(ipc_single_command(bar->ipc_event_socketfd, IPC_SUBSCRIBE, subscribe, &len)); return true; |