|
|
|
@ -18,6 +18,7 @@
|
|
|
|
|
#include <wlr/types/wlr_output.h>
|
|
|
|
|
#include <xkbcommon/xkbcommon.h>
|
|
|
|
|
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
|
|
|
|
#include "sway/desktop/idle_inhibit_v1.h"
|
|
|
|
|
|
|
|
|
|
static const int i3_output_id = INT32_MAX;
|
|
|
|
|
static const int i3_scratch_id = INT32_MAX - 1;
|
|
|
|
@ -139,6 +140,22 @@ static const char *ipc_json_xwindow_type_description(struct sway_view *view) {
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static const char *ipc_json_user_idle_inhibitor_description(enum sway_idle_inhibit_mode mode) {
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case INHIBIT_IDLE_FOCUS:
|
|
|
|
|
return "focus";
|
|
|
|
|
case INHIBIT_IDLE_FULLSCREEN:
|
|
|
|
|
return "fullscreen";
|
|
|
|
|
case INHIBIT_IDLE_OPEN:
|
|
|
|
|
return "open";
|
|
|
|
|
case INHIBIT_IDLE_VISIBLE:
|
|
|
|
|
return "visible";
|
|
|
|
|
case INHIBIT_IDLE_APPLICATION:
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
json_object *ipc_json_get_version(void) {
|
|
|
|
|
int major = 0, minor = 0, patch = 0;
|
|
|
|
|
json_object *version = json_object_new_object();
|
|
|
|
@ -492,6 +509,36 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
|
|
|
|
|
|
|
|
|
|
json_object_object_add(object, "shell", json_object_new_string(view_get_shell(c->view)));
|
|
|
|
|
|
|
|
|
|
json_object_object_add(object, "inhibit_idle",
|
|
|
|
|
json_object_new_boolean(view_inhibit_idle(c->view)));
|
|
|
|
|
|
|
|
|
|
json_object *idle_inhibitors = json_object_new_object();
|
|
|
|
|
|
|
|
|
|
struct sway_idle_inhibitor_v1 *user_inhibitor =
|
|
|
|
|
sway_idle_inhibit_v1_user_inhibitor_for_view(c->view);
|
|
|
|
|
|
|
|
|
|
if (user_inhibitor) {
|
|
|
|
|
json_object_object_add(idle_inhibitors, "user",
|
|
|
|
|
json_object_new_string(
|
|
|
|
|
ipc_json_user_idle_inhibitor_description(user_inhibitor->mode)));
|
|
|
|
|
} else {
|
|
|
|
|
json_object_object_add(idle_inhibitors, "user",
|
|
|
|
|
json_object_new_string("none"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct sway_idle_inhibitor_v1 *application_inhibitor =
|
|
|
|
|
sway_idle_inhibit_v1_application_inhibitor_for_view(c->view);
|
|
|
|
|
|
|
|
|
|
if (application_inhibitor) {
|
|
|
|
|
json_object_object_add(idle_inhibitors, "application",
|
|
|
|
|
json_object_new_string("enabled"));
|
|
|
|
|
} else {
|
|
|
|
|
json_object_object_add(idle_inhibitors, "application",
|
|
|
|
|
json_object_new_string("none"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
json_object_object_add(object, "idle_inhibitors", idle_inhibitors);
|
|
|
|
|
|
|
|
|
|
#if HAVE_XWAYLAND
|
|
|
|
|
if (c->view->type == SWAY_VIEW_XWAYLAND) {
|
|
|
|
|
json_object_object_add(object, "window",
|
|
|
|
|