diff --git a/libtaskmanager/abstracttasksmodel.h b/libtaskmanager/abstracttasksmodel.h --- a/libtaskmanager/abstracttasksmodel.h +++ b/libtaskmanager/abstracttasksmodel.h @@ -85,7 +85,12 @@ IsDemandingAttention, /**< Task is demanding attention. */ SkipTaskbar, /**< Task should not be shown in a 'task bar' user interface. */ SkipPager, /**< Task should not to be shown in a 'pager' user interface. */ - AppPid, /**< Application Process ID */ + AppPid, /**< Application Process ID. This is provided best-effort, and may not + be what you expect: For window tasks owned by processes started + from e.g. kwin_wayland, it would be the process id of kwin + itself. DO NOT use this for destructive actions such as closing + the application. The intended use case is to try and (smartly) + gather more information about the task when needed. */ }; Q_ENUM(AdditionalRoles) diff --git a/libtaskmanager/waylandtasksmodel.cpp b/libtaskmanager/waylandtasksmodel.cpp --- a/libtaskmanager/waylandtasksmodel.cpp +++ b/libtaskmanager/waylandtasksmodel.cpp @@ -226,6 +226,10 @@ QObject::connect(window, &KWayland::Client::PlasmaWindow::skipTaskbarChanged, q, [window, this] { this->dataChanged(window, SkipTaskbar); } ); + + QObject::connect(window, &KWayland::Client::PlasmaWindow::pidChanged, q, + [window, this] { this->dataChanged(window, AppPid); } + ); } AppData WaylandTasksModel::Private::appData(KWayland::Client::PlasmaWindow *window) @@ -333,7 +337,7 @@ } else if (role == SkipPager) { // FIXME Implement. } else if (role == AppPid) { - // FIXME Implement. + return window->pid(); } return QVariant();