diff options
author | llyyr <llyyr@yukari.in> | 2024-02-27 01:40:22 +0530 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2024-02-29 00:51:43 +0100 |
commit | 2867ef646b67138a796b7d5ae46428c255cc928f (patch) | |
tree | 1ec60ea569a9fa994d2f1248e937e32ea32ec47c /sway | |
parent | Convert to new pointer enums (diff) | |
download | sway-2867ef646b67138a796b7d5ae46428c255cc928f.tar.gz sway-2867ef646b67138a796b7d5ae46428c255cc928f.tar.zst sway-2867ef646b67138a796b7d5ae46428c255cc928f.zip |
ipc: add `floating` property to GET_TREE
i3 has had this property for over a decade but it wasn't documented
until a couple of years ago, so it was likely missed when developing
sway. Add the property to get us closer to ipc parity with i3.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/ipc-json.c | 8 | ||||
-rw-r--r-- | sway/sway-ipc.7.scd | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 58356d4e..84e164e4 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -288,6 +288,7 @@ static json_object *ipc_json_create_node(int id, const char* type, char *name, | |||
288 | json_object_object_add(object, "focus", focus); | 288 | json_object_object_add(object, "focus", focus); |
289 | json_object_object_add(object, "fullscreen_mode", json_object_new_int(0)); | 289 | json_object_object_add(object, "fullscreen_mode", json_object_new_int(0)); |
290 | json_object_object_add(object, "sticky", json_object_new_boolean(false)); | 290 | json_object_object_add(object, "sticky", json_object_new_boolean(false)); |
291 | json_object_object_add(object, "floating", NULL); | ||
291 | 292 | ||
292 | return object; | 293 | return object; |
293 | } | 294 | } |
@@ -675,7 +676,8 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object | |||
675 | static void ipc_json_describe_container(struct sway_container *c, json_object *object) { | 676 | static void ipc_json_describe_container(struct sway_container *c, json_object *object) { |
676 | json_object_object_add(object, "name", | 677 | json_object_object_add(object, "name", |
677 | c->title ? json_object_new_string(c->title) : NULL); | 678 | c->title ? json_object_new_string(c->title) : NULL); |
678 | if (container_is_floating(c)) { | 679 | bool floating = container_is_floating(c); |
680 | if (floating) { | ||
679 | json_object_object_add(object, "type", | 681 | json_object_object_add(object, "type", |
680 | json_object_new_string("floating_con")); | 682 | json_object_new_string("floating_con")); |
681 | } | 683 | } |
@@ -693,6 +695,10 @@ static void ipc_json_describe_container(struct sway_container *c, json_object *o | |||
693 | json_object_object_add(object, "urgent", json_object_new_boolean(urgent)); | 695 | json_object_object_add(object, "urgent", json_object_new_boolean(urgent)); |
694 | json_object_object_add(object, "sticky", json_object_new_boolean(c->is_sticky)); | 696 | json_object_object_add(object, "sticky", json_object_new_boolean(c->is_sticky)); |
695 | 697 | ||
698 | // sway doesn't track the floating reason, so we can't use "auto_on" or "user_off" | ||
699 | json_object_object_add(object, "floating", | ||
700 | json_object_new_string(floating ? "user_on" : "auto_off")); | ||
701 | |||
696 | json_object_object_add(object, "fullscreen_mode", | 702 | json_object_object_add(object, "fullscreen_mode", |
697 | json_object_new_int(c->pending.fullscreen_mode)); | 703 | json_object_new_int(c->pending.fullscreen_mode)); |
698 | 704 | ||
diff --git a/sway/sway-ipc.7.scd b/sway/sway-ipc.7.scd index f4a5ccff..5859558f 100644 --- a/sway/sway-ipc.7.scd +++ b/sway/sway-ipc.7.scd | |||
@@ -376,6 +376,9 @@ node and will have the following properties: | |||
376 | : integer | 376 | : integer |
377 | : (Only containers and views) The fullscreen mode of the node. 0 means none, 1 means | 377 | : (Only containers and views) The fullscreen mode of the node. 0 means none, 1 means |
378 | full workspace, and 2 means global fullscreen | 378 | full workspace, and 2 means global fullscreen |
379 | |- floating | ||
380 | : string | ||
381 | : Floating state of container. Can be either "auto_off" or "user_on" | ||
379 | |- app_id | 382 | |- app_id |
380 | : string | 383 | : string |
381 | : (Only views) For an xdg-shell view, the name of the application, if set. | 384 | : (Only views) For an xdg-shell view, the name of the application, if set. |