summaryrefslogtreecommitdiff
path: root/src/desktop/LayerSurface.cpp
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-02-26 23:03:06 +0800
committerGitHub <noreply@github.com>2025-02-26 16:03:06 +0100
commit01f4074421059006b44b97cda00094a318e63d5f (patch)
treec387ae0ae132bd3b1e4ebf466d3d3b2820c6c8a7 /src/desktop/LayerSurface.cpp
parent6787fe8933b54f9e68f123df457e502dee9be13a (diff)
hyprctl/layers: print pid for layershell clients (#9468)
Adds a `getPID()` fn to layershell to print it in `hyprctl layers`
Diffstat (limited to 'src/desktop/LayerSurface.cpp')
-rw-r--r--src/desktop/LayerSurface.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp
index f4ffaedf..428dcbbc 100644
--- a/src/desktop/LayerSurface.cpp
+++ b/src/desktop/LayerSurface.cpp
@@ -584,3 +584,15 @@ int CLayerSurface::popupsCount() {
MONITORID CLayerSurface::monitorID() {
return monitor ? monitor->ID : MONITOR_INVALID;
}
+
+pid_t CLayerSurface::getPID() {
+ pid_t PID = -1;
+
+ if (!layerSurface || !layerSurface->surface || !layerSurface->surface->getResource() || !layerSurface->surface->getResource()->resource() ||
+ !layerSurface->surface->getResource()->resource()->client)
+ return -1;
+
+ wl_client_get_credentials(layerSurface->surface->getResource()->resource()->client, &PID, nullptr, nullptr);
+
+ return PID;
+}