Skip to content

Commit

Permalink
Various App Category fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MeisApps committed Oct 10, 2022
1 parent dbdff57 commit 5a85c7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/api/process/ProcessManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ std::vector<ProcessNode *> ProcessManager::m_TreeProcessesCache;
std::map<int, ProcessCPUTimes> ProcessManager::m_PidCpuTimes;
std::map<int, ProcessIOUsage> ProcessManager::m_PidIOUsages;

std::vector<std::string> g_AppBlacklist = {"gnome-shell", "plasmashell"}; // NOLINT(cert-err58-cpp)
std::vector<std::string> g_AppBlacklist = {"gnome-shell", "plasmashell", "evolution-alarm-notify", "gsd-disk-utility-notify",
"xdg-dbus-proxy", "mailsync.bin", "chrome_crashpad_handler"}; // NOLINT(cert-err58-cpp)
std::vector<std::string> g_AppParentBlacklist = {"bash", "bwrap"};

inline bool is_in_app_blacklist(ProcessNode *node) {
Expand Down Expand Up @@ -175,6 +176,9 @@ std::vector<ProcessNode *> ProcessManager::GetAppProcessesByFilter(const std::fu
}
}

if(is_in_app_blacklist(realProc))
continue;

for(auto child : realProc->FlatTree()) {
if(Utils::vectorContains(pids, child->GetPid()))
continue;
Expand Down
7 changes: 6 additions & 1 deletion src/utils/CGUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "CGUtils.h"

#include "IOUtils.h"
#include <filesystem>
#include <unistd.h>

Expand All @@ -17,7 +18,11 @@ std::vector<int> CGUtils::GetAllPidsWithWindows() {
if(!std::regex_match(nameStr, matches, entryRegex))
continue;

result.emplace_back(Utils::stringToInt(matches[3].str()));
for(const auto& pidStr : IOUtils::ReadAllLines(dirEntry.path().string() + "/cgroup.procs")) {
auto pid = Utils::stringToInt(pidStr);
if(pid > 0)
result.emplace_back(pid);
}
}

return result;
Expand Down

0 comments on commit 5a85c7c

Please sign in to comment.