Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,24 @@
"value": true,
"serial": 0,
"flags": [],
"name": "cgroupsBasedGrouping",
"name": "CGroups-based Grouping",
"name[zh_CN]": "基于 cgroups 的任务图标分组",
"description": "Enable cgroups-based task grouping",
"description[zh_CN]": "启用基于 cgroups 的任务图标分组",
"permissions": "readonly",
"visibility": "private"
},
"cgroupsBasedGroupingSkipAppIds": {
"value": ["deepin-terminal"],
"serial": 0,
"flags": [],
"name": "CGroups-Based Grouping Skipped App IDs",
"name[zh_CN]": "基于 cgroups 的任务图标分组所应跳过的应用列表",
"description": "List of app id that cgroups-based grouping should skip checking",
"description[zh_CN]": "一个表示基于 CGroups 的应用分组所应当跳过的 App ID 列表",
"permissions": "readwrite",
"visibility": "private"
},
"Docked_Items": {
"value": ["id: dde-file-manager,type: amAPP", "id: org.deepin.browser,type: amAPP", "id: deepin-app-store,type: amAPP", "id: org.deepin.dde.control-center, type: amAPP", "id: deepin-music,type: amAPP", "id: deepin-editor,type: amAPP", "id: deepin-mail,type: amAPP","id: deepin-terminal,type: amAPP","id: dde-calendar,type: amAPP", "id: deepin-calculator,type: amAPP"],
"serial": 0,
Expand Down
1 change: 1 addition & 0 deletions panels/dock/taskmanager/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static inline const QString DOCK_ACTION_DOCK = "dock-action-dock";
static inline const QString TASKMANAGER_ALLOWFOCEQUIT_KEY = "Allow_Force_Quit";
static inline const QString TASKMANAGER_WINDOWSPLIT_KEY = "noTaskGrouping";
static inline const QString TASKMANAGER_CGROUPS_BASED_GROUPING_KEY = "cgroupsBasedGrouping";
static inline const QString TASKMANAGER_CGROUPS_BASED_GROUPING_SKIP_APPIDS = "cgroupsBasedGroupingSkipAppIds";
static inline const QString TASKMANAGER_DOCKEDITEMS_KEY = "Docked_Items";
constexpr auto TASKMANAGER_DOCKEDELEMENTS_KEY = "dockedElements";

Expand Down
16 changes: 9 additions & 7 deletions panels/dock/taskmanager/taskmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,16 @@ bool TaskManager::init()
}
}
}

// 尝试通过AM(Application Manager)匹配应用程序
auto desktopId = getDesktopIdByPid(identifies);
if (!desktopId.isEmpty()) {
auto res = model->match(model->index(0, 0), roleNames.key(MODEL_DESKTOPID), desktopId, 1, Qt::MatchFixedString | Qt::MatchWrap).value(0);
if (res.isValid()) {
qCDebug(taskManagerLog) << "matched by AM desktop ID:" << desktopId << res;
return res;
if (Settings->cgroupsBasedGrouping()) {
auto desktopId = getDesktopIdByPid(identifies);
if (!desktopId.isEmpty() && !Settings->cgroupsBasedGroupingSkipIds().contains(desktopId)) {
auto res = model->match(model->index(0, 0), roleNames.key(MODEL_DESKTOPID), desktopId, 1, Qt::MatchFixedString | Qt::MatchWrap).value(0);
if (res.isValid()) {
qCDebug(taskManagerLog) << "matched by AM desktop ID:" << desktopId << res;
return res;
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions panels/dock/taskmanager/taskmanagersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
m_windowSplit = m_taskManagerDconfig->value(TASKMANAGER_WINDOWSPLIT_KEY).toBool();
m_cgroupsBasedGrouping = m_taskManagerDconfig->value(TASKMANAGER_CGROUPS_BASED_GROUPING_KEY, true).toBool();
m_dockedElements = m_taskManagerDconfig->value(TASKMANAGER_DOCKEDELEMENTS_KEY, {}).toStringList();
m_cgroupsBasedGroupingSkipAppIds = m_taskManagerDconfig->value(TASKMANAGER_CGROUPS_BASED_GROUPING_SKIP_APPIDS, {"deepin-terminal"}).toStringList();
migrateFromDockedItems();
}

Expand Down Expand Up @@ -83,7 +84,12 @@
return m_cgroupsBasedGrouping;
}

QStringList TaskManagerSettings::cgroupsBasedGroupingSkipIds() const

Check warning on line 87 in panels/dock/taskmanager/taskmanagersettings.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'cgroupsBasedGroupingSkipIds' is never used.
{
return m_cgroupsBasedGroupingSkipAppIds;
}

QStringList TaskManagerSettings::dockedElements() const

Check warning on line 92 in panels/dock/taskmanager/taskmanagersettings.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'dockedElements' is never used.
{
return m_dockedElements;
}
Expand Down
2 changes: 2 additions & 0 deletions panels/dock/taskmanager/taskmanagersettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class TaskManagerSettings : public QObject
void setWindowSplit(bool split);

bool cgroupsBasedGrouping() const;
QStringList cgroupsBasedGroupingSkipIds() const;

void setDockedElements(const QStringList &elements);
void toggleDockedElement(const QString &element);
Expand All @@ -56,5 +57,6 @@ class TaskManagerSettings : public QObject
bool m_windowSplit;
bool m_cgroupsBasedGrouping;
QStringList m_dockedElements;
QStringList m_cgroupsBasedGroupingSkipAppIds;
};
}