From 00539935ba6206a1c410f7de9509b925957c67f1 Mon Sep 17 00:00:00 2001 From: Jim Ramsay Date: Tue, 6 Dec 2022 20:03:06 -0500 Subject: [PATCH] Add output power state to get_outputs ipc command I forgot to plumb this through when I did the initial state on the output power state. Signed-off-by: Jim Ramsay --- include/ctl-server.h | 1 + src/ctl-server.c | 5 +++-- src/main.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/ctl-server.h b/include/ctl-server.h index bfb7783..d0fc141 100644 --- a/include/ctl-server.h +++ b/include/ctl-server.h @@ -33,6 +33,7 @@ struct ctl_server_output { unsigned height; unsigned width; bool captured; + char power[8]; }; struct ctl_server_actions { diff --git a/src/ctl-server.c b/src/ctl-server.c index 6e38b90..6661d54 100644 --- a/src/ctl-server.c +++ b/src/ctl-server.c @@ -380,12 +380,13 @@ static struct cmd_response* generate_output_list(struct ctl* self) response->data = json_array(); for (size_t i = 0; i < num_outputs; ++i) json_array_append_new(response->data, json_pack( - "{s:s, s:s, s:i, s:i, s:b}", + "{s:s, s:s, s:i, s:i, s:b, s:s}", "name", outputs[i].name, "description", outputs[i].description, "height", outputs[i].height, "width", outputs[i].width, - "captured", outputs[i].captured)); + "captured", outputs[i].captured, + "power", outputs[i].power)); free(outputs); return response; } diff --git a/src/main.c b/src/main.c index 45b45dd..ca8b457 100644 --- a/src/main.c +++ b/src/main.c @@ -537,6 +537,8 @@ static int get_output_list(struct ctl* ctl, item->height = output->height; item->width = output->width; item->captured = (output->id == self->selected_output->id); + strlcpy(item->power, output_power_state_name(output->power), + sizeof(item->power)); item++; } return n;