From 01f4074421059006b44b97cda00094a318e63d5f Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 26 Feb 2025 23:03:06 +0800 Subject: hyprctl/layers: print pid for layershell clients (#9468) Adds a `getPID()` fn to layershell to print it in `hyprctl layers` --- src/desktop/LayerSurface.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/desktop/LayerSurface.cpp') 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; +} -- cgit v1.2.3