aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-09-19 17:37:58 -0400
committerGitHub <noreply@github.com>2018-09-19 17:37:58 -0400
commit6ec362622841a3efe336daf9e74edca16e4bf984 (patch)
treecc5389a07ff451e7ad3c0b9ab8479723623e21b0
parentf0fb27aba6b6e4d14fe0ce6e6e7d3dfa3fdf91fa (diff)
parent81f3fda6fa9b0789c8b40582a4b85b2e9501c185 (diff)
downloadsway-6ec362622841a3efe336daf9e74edca16e4bf984.tar.xz
Merge pull request #2676 from ianyfan/ipc
ipc: add pid information for views in layout tree
-rw-r--r--include/sway/tree/view.h2
-rw-r--r--sway/ipc-json.c2
-rw-r--r--sway/tree/view.c1
3 files changed, 5 insertions, 0 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 439dc1bf..d10251dd 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -61,6 +61,8 @@ struct sway_view {
struct sway_container *container; // NULL if unmapped and transactions finished
struct wlr_surface *surface; // NULL for unmapped views
+ pid_t pid;
+
// Geometry of the view itself (excludes borders) in layout coordinates
double x, y;
int width, height;
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 52278be2..f054ac9f 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -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) {
+ json_object_object_add(object, "pid", json_object_new_int(c->view->pid));
+
const char *app_id = view_get_app_id(c->view);
json_object_object_add(object, "app_id",
app_id ? json_object_new_string(app_id) : NULL);
diff --git a/sway/tree/view.c b/sway/tree/view.c
index e4e1c161..4398f518 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -470,6 +470,7 @@ static struct sway_workspace *select_workspace(struct sway_view *view) {
wl_resource_get_client(view->surface->resource);
wl_client_get_credentials(client, &pid, NULL, NULL);
#endif
+ view->pid = pid;
ws = root_workspace_for_pid(pid);
if (ws) {
return ws;