Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sway/ipc-json: add foreign_toplevel_identifier to IPC_GET_TREE output #8570

Merged
merged 1 commit into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sway/ipc-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <wlr/config.h>
#include <wlr/types/wlr_content_type_v1.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_ext_foreign_toplevel_list_v1.h>
#include <xkbcommon/xkbcommon.h>
#include "config.h"
#include "log.h"
Expand Down Expand Up @@ -577,6 +578,10 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
json_object_object_add(object, "app_id",
app_id ? json_object_new_string(app_id) : NULL);

json_object_object_add(object, "foreign_toplevel_identifier",
c->view->ext_foreign_toplevel ?
json_object_new_string(c->view->ext_foreign_toplevel->identifier) : NULL);

bool visible = view_is_visible(c->view);
json_object_object_add(object, "visible", json_object_new_boolean(visible));

Expand Down
3 changes: 3 additions & 0 deletions sway/sway-ipc.7.scd
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ node and will have the following properties:
|- pid
: integer
: (Only views) The PID of the application that owns the view
|- foreign_toplevel_identifier
: string
: (Only views) The ext-foreign-toplevel-list-v1 toplevel identifier of this node.
|- visible
: boolean
: (Only views) Whether the node is visible
Expand Down
4 changes: 4 additions & 0 deletions swaymsg/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ static void pretty_print_tree(json_object *obj, int indent) {
const char *instance = json_object_get_string(json_object_object_get(window_props_obj, "instance"));
const char *class = json_object_get_string(json_object_object_get(window_props_obj, "class"));
int x11_id = json_object_get_int(json_object_object_get(obj, "window"));
const char *foreign_toplevel_id = json_object_get_string(json_object_object_get(obj, "foreign_toplevel_identifier"));
const char *sandbox_engine = json_object_get_string(json_object_object_get(obj, "sandbox_engine"));
const char *sandbox_app_id = json_object_get_string(json_object_object_get(obj, "sandbox_app_id"));
const char *sandbox_instance_id = json_object_get_string(json_object_object_get(obj, "sandbox_instance_id"));
Expand All @@ -347,6 +348,9 @@ static void pretty_print_tree(json_object *obj, int indent) {
if (x11_id != 0) {
printf(", X11 window: 0x%X", x11_id);
}
if (foreign_toplevel_id != NULL) {
printf(", foreign_toplevel_id: \"%s\"", foreign_toplevel_id);
}
if (sandbox_engine != NULL) {
printf(", sandbox_engine: \"%s\"", sandbox_engine);
}
Expand Down