diff options
author | Simon Ser <contact@emersion.fr> | 2023-02-01 16:19:41 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2023-02-01 11:32:57 -0500 |
commit | 40eb29e7c56b67c2112ead7f048e45220a1c2887 (patch) | |
tree | d29b0d25eafeb8e93ad3f067658d3930d0020665 /sway/ipc-server.c | |
parent | Added reference for event types to swaymsg manpage (diff) | |
download | sway-40eb29e7c56b67c2112ead7f048e45220a1c2887.tar.gz sway-40eb29e7c56b67c2112ead7f048e45220a1c2887.tar.zst sway-40eb29e7c56b67c2112ead7f048e45220a1c2887.zip |
ipc: add support for output event
For compatibility with i3 [1].
[1]: https://i3wm.org/docs/ipc.html#_output_event
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r-- | sway/ipc-server.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 51244436..2941ee76 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -508,6 +508,20 @@ void ipc_event_input(const char *change, struct sway_input_device *device) { | |||
508 | json_object_put(json); | 508 | json_object_put(json); |
509 | } | 509 | } |
510 | 510 | ||
511 | void ipc_event_output(void) { | ||
512 | if (!ipc_has_event_listeners(IPC_EVENT_OUTPUT)) { | ||
513 | return; | ||
514 | } | ||
515 | sway_log(SWAY_DEBUG, "Sending output event"); | ||
516 | |||
517 | json_object *json = json_object_new_object(); | ||
518 | json_object_object_add(json, "change", json_object_new_string("unspecified")); | ||
519 | |||
520 | const char *json_string = json_object_to_json_string(json); | ||
521 | ipc_send_event(json_string, IPC_EVENT_OUTPUT); | ||
522 | json_object_put(json); | ||
523 | } | ||
524 | |||
511 | int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data) { | 525 | int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data) { |
512 | struct ipc_client *client = data; | 526 | struct ipc_client *client = data; |
513 | 527 | ||