summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2016-11-14 11:27:56 +0100
committerKai Uwe Broulik <[email protected]>2016-11-14 11:27:56 +0100
commitb5a83d08504da15014e3a12295ff41f543d20c47 (patch)
tree99ebe718b88fda41dbde75e99c82292dc0d70e2f
parent341a534e9d16eaf89f137136bdbff5756db78775 (diff)
[libtaskmanager] Expose process ID of application
Works on X11, Wayland implementation pending. Differential Revision: https://phabricator.kde.org/D3301
-rw-r--r--libtaskmanager/abstracttasksmodel.h1
-rw-r--r--libtaskmanager/waylandtasksmodel.cpp2
-rw-r--r--libtaskmanager/xwindowtasksmodel.cpp6
3 files changed, 7 insertions, 2 deletions
diff --git a/libtaskmanager/abstracttasksmodel.h b/libtaskmanager/abstracttasksmodel.h
index b0b10db..761d97c 100644
--- a/libtaskmanager/abstracttasksmodel.h
+++ b/libtaskmanager/abstracttasksmodel.h
@@ -83,6 +83,7 @@ public:
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 */
};
Q_ENUM(AdditionalRoles)
diff --git a/libtaskmanager/waylandtasksmodel.cpp b/libtaskmanager/waylandtasksmodel.cpp
index 5f82292..37f6340 100644
--- a/libtaskmanager/waylandtasksmodel.cpp
+++ b/libtaskmanager/waylandtasksmodel.cpp
@@ -332,6 +332,8 @@ QVariant WaylandTasksModel::data(const QModelIndex &index, int role) const
return window->skipTaskbar();
} else if (role == SkipPager) {
// FIXME Implement.
+ } else if (role == AppPid) {
+ // FIXME Implement.
}
return QVariant();
diff --git a/libtaskmanager/xwindowtasksmodel.cpp b/libtaskmanager/xwindowtasksmodel.cpp
index 6629995..2aacd20 100644
--- a/libtaskmanager/xwindowtasksmodel.cpp
+++ b/libtaskmanager/xwindowtasksmodel.cpp
@@ -52,7 +52,7 @@ namespace TaskManager
{
static const NET::Properties windowInfoFlags = NET::WMState | NET::XAWMState | NET::WMDesktop |
- NET::WMVisibleName | NET::WMGeometry | NET::WMFrameExtents | NET::WMWindowType;
+ NET::WMVisibleName | NET::WMGeometry | NET::WMFrameExtents | NET::WMWindowType | NET::WMPid;
static const NET::Properties2 windowInfoFlags2 = NET::WM2DesktopFileName | NET::WM2Activities |
NET::WM2WindowClass | NET::WM2AllowedActions;
@@ -346,7 +346,7 @@ void XWindowTasksModel::Private::windowChanged(WId window, NET::Properties prope
|| properties2 & (NET::WM2DesktopFileName | NET::WM2WindowClass)) {
wipeInfoCache = true;
wipeAppDataCache = true;
- changedRoles << Qt::DisplayRole << Qt::DecorationRole << AppId << AppName << GenericName << LauncherUrl;
+ changedRoles << Qt::DisplayRole << Qt::DecorationRole << AppId << AppName << GenericName << LauncherUrl << AppPid;
}
if ((properties & NET::WMIcon) && !changedRoles.contains(Qt::DecorationRole)) {
@@ -926,6 +926,8 @@ QVariant XWindowTasksModel::data(const QModelIndex &index, int role) const
return (info->hasState(NET::SkipTaskbar) || info->windowType(NET::UtilityMask) == NET::Utility);
} else if (role == SkipPager) {
return d->windowInfo(window)->hasState(NET::SkipPager);
+ } else if (role == AppPid) {
+ return d->windowInfo(window)->pid();
}
return QVariant();