diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-02-26 23:03:06 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-26 16:03:06 +0100 |
| commit | 01f4074421059006b44b97cda00094a318e63d5f (patch) | |
| tree | c387ae0ae132bd3b1e4ebf466d3d3b2820c6c8a7 /src/desktop/LayerSurface.cpp | |
| parent | 6787fe8933b54f9e68f123df457e502dee9be13a (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.cpp | 12 |
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; +} |
