mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2024-12-28 22:23:42 +01:00
ipc: add pid information for views in layout tree
This commit is contained in:
parent
5912325d5c
commit
81f3fda6fa
3 changed files with 5 additions and 0 deletions
|
@ -61,6 +61,8 @@ struct sway_view {
|
||||||
struct sway_container *container; // NULL if unmapped and transactions finished
|
struct sway_container *container; // NULL if unmapped and transactions finished
|
||||||
struct wlr_surface *surface; // NULL for unmapped views
|
struct wlr_surface *surface; // NULL for unmapped views
|
||||||
|
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
// Geometry of the view itself (excludes borders) in layout coordinates
|
// Geometry of the view itself (excludes borders) in layout coordinates
|
||||||
double x, y;
|
double x, y;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
|
@ -221,6 +221,8 @@ static const char *describe_container_border(enum sway_container_border border)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ipc_json_describe_view(struct sway_container *c, json_object *object) {
|
static void ipc_json_describe_view(struct sway_container *c, json_object *object) {
|
||||||
|
json_object_object_add(object, "pid", json_object_new_int(c->view->pid));
|
||||||
|
|
||||||
const char *app_id = view_get_app_id(c->view);
|
const char *app_id = view_get_app_id(c->view);
|
||||||
json_object_object_add(object, "app_id",
|
json_object_object_add(object, "app_id",
|
||||||
app_id ? json_object_new_string(app_id) : NULL);
|
app_id ? json_object_new_string(app_id) : NULL);
|
||||||
|
|
|
@ -470,6 +470,7 @@ static struct sway_workspace *select_workspace(struct sway_view *view) {
|
||||||
wl_resource_get_client(view->surface->resource);
|
wl_resource_get_client(view->surface->resource);
|
||||||
wl_client_get_credentials(client, &pid, NULL, NULL);
|
wl_client_get_credentials(client, &pid, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
view->pid = pid;
|
||||||
ws = root_workspace_for_pid(pid);
|
ws = root_workspace_for_pid(pid);
|
||||||
if (ws) {
|
if (ws) {
|
||||||
return ws;
|
return ws;
|
||||||
|
|
Loading…
Reference in a new issue