graesslin added a comment.
Please note that the code you wrote will give you an incorrect PID for all XWayland windows. Instead of going through the ClientConnection I suggest to use KWin::Toplevel::pid(). That one returns the correct pid for all X windows. But it would crash for Wayland windows currently. So make this method virtual and override it in ShellClient and add the code for getting the pid from the surface in ShellClient. REPOSITORY R108 KWin REVISION DETAIL https://phabricator.kde.org/D5756 To: hein, #plasma, sebas, graesslin Cc: kwin, plasma-devel, #kwin, ZrenBot, spstarr, progwolff, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, lukas