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;