diff options
Diffstat (limited to 'swaybar/main.c')
-rw-r--r-- | swaybar/main.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/swaybar/main.c b/swaybar/main.c index 3ac337d1..2ee25589 100644 --- a/swaybar/main.c +++ b/swaybar/main.c | |||
@@ -66,7 +66,7 @@ struct status_block { | |||
66 | list_t *status_line = NULL; | 66 | list_t *status_line = NULL; |
67 | 67 | ||
68 | list_t *workspaces = NULL; | 68 | list_t *workspaces = NULL; |
69 | int ipc_socketfd, ipc_listen_socketfd; | 69 | int ipc_socketfd, ipc_event_socketfd; |
70 | pid_t pid; | 70 | pid_t pid; |
71 | int status_read_fd; | 71 | int status_read_fd; |
72 | char line[1024]; | 72 | char line[1024]; |
@@ -156,8 +156,8 @@ void swaybar_teardown() { | |||
156 | close(ipc_socketfd); | 156 | close(ipc_socketfd); |
157 | } | 157 | } |
158 | 158 | ||
159 | if (ipc_listen_socketfd) { | 159 | if (ipc_event_socketfd) { |
160 | close(ipc_listen_socketfd); | 160 | close(ipc_event_socketfd); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
@@ -408,9 +408,9 @@ void bar_ipc_init(int outputi, const char *bar_id) { | |||
408 | json_object_put(bar_config); | 408 | json_object_put(bar_config); |
409 | free(res); | 409 | free(res); |
410 | 410 | ||
411 | const char *subscribe_json = "[ \"workspace\" ]"; | 411 | const char *subscribe_json = "[ \"workspace\", \"mode\" ]"; |
412 | len = strlen(subscribe_json); | 412 | len = strlen(subscribe_json); |
413 | res = ipc_single_command(ipc_listen_socketfd, IPC_SUBSCRIBE, subscribe_json, &len); | 413 | res = ipc_single_command(ipc_event_socketfd, IPC_SUBSCRIBE, subscribe_json, &len); |
414 | free(res); | 414 | free(res); |
415 | 415 | ||
416 | ipc_update_workspaces(); | 416 | ipc_update_workspaces(); |
@@ -1049,7 +1049,7 @@ void poll_for_update() { | |||
1049 | 1049 | ||
1050 | dirty = false; | 1050 | dirty = false; |
1051 | FD_ZERO(&readfds); | 1051 | FD_ZERO(&readfds); |
1052 | FD_SET(ipc_listen_socketfd, &readfds); | 1052 | FD_SET(ipc_event_socketfd, &readfds); |
1053 | FD_SET(status_read_fd, &readfds); | 1053 | FD_SET(status_read_fd, &readfds); |
1054 | 1054 | ||
1055 | activity = select(FD_SETSIZE, &readfds, NULL, NULL, NULL); | 1055 | activity = select(FD_SETSIZE, &readfds, NULL, NULL, NULL); |
@@ -1057,11 +1057,10 @@ void poll_for_update() { | |||
1057 | sway_log(L_ERROR, "polling failed: %d", errno); | 1057 | sway_log(L_ERROR, "polling failed: %d", errno); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | if (FD_ISSET(ipc_listen_socketfd, &readfds)) { | 1060 | if (FD_ISSET(ipc_event_socketfd, &readfds)) { |
1061 | sway_log(L_DEBUG, "Got workspace update."); | 1061 | sway_log(L_DEBUG, "Got workspace update."); |
1062 | uint32_t len; | 1062 | struct ipc_response *resp = ipc_recv_response(ipc_event_socketfd); |
1063 | char *buf = ipc_recv_response(ipc_listen_socketfd, &len); | 1063 | free_ipc_response(resp); |
1064 | free(buf); | ||
1065 | ipc_update_workspaces(); | 1064 | ipc_update_workspaces(); |
1066 | dirty = true; | 1065 | dirty = true; |
1067 | } | 1066 | } |
@@ -1165,7 +1164,7 @@ int main(int argc, char **argv) { | |||
1165 | } | 1164 | } |
1166 | } | 1165 | } |
1167 | ipc_socketfd = ipc_open_socket(socket_path); | 1166 | ipc_socketfd = ipc_open_socket(socket_path); |
1168 | ipc_listen_socketfd = ipc_open_socket(socket_path); | 1167 | ipc_event_socketfd = ipc_open_socket(socket_path); |
1169 | 1168 | ||
1170 | 1169 | ||
1171 | if (argc == optind) { | 1170 | if (argc == optind) { |