mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-01 20:51:58 -07:00
misc: scan ppids in exec rules
This commit is contained in:
@@ -1673,18 +1673,22 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
|
|||||||
returns.push_back(rule);
|
returns.push_back(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint64_t PID = pWindow->getPID();
|
std::vector<uint64_t> PIDs = {(uint64_t)pWindow->getPID()};
|
||||||
bool anyExecFound = false;
|
while (getPPIDof(PIDs.back()) > 10)
|
||||||
|
PIDs.push_back(getPPIDof(PIDs.back()));
|
||||||
|
|
||||||
|
bool anyExecFound = false;
|
||||||
|
|
||||||
for (auto& er : execRequestedRules) {
|
for (auto& er : execRequestedRules) {
|
||||||
if (er.iPid == PID) {
|
if (std::ranges::any_of(PIDs, [&](const auto& pid) { return pid == er.iPid; })) {
|
||||||
returns.push_back({er.szRule, "execRule"});
|
returns.push_back({er.szRule, "execRule"});
|
||||||
anyExecFound = true;
|
anyExecFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anyExecFound) // remove exec rules to unclog searches in the future, why have the garbage here.
|
if (anyExecFound) // remove exec rules to unclog searches in the future, why have the garbage here.
|
||||||
execRequestedRules.erase(std::remove_if(execRequestedRules.begin(), execRequestedRules.end(), [&](const SExecRequestedRule& other) { return other.iPid == PID; }));
|
execRequestedRules.erase(std::remove_if(execRequestedRules.begin(), execRequestedRules.end(),
|
||||||
|
[&](const SExecRequestedRule& other) { return std::ranges::any_of(PIDs, [&](const auto& pid) { return pid == other.iPid; }); }));
|
||||||
|
|
||||||
return returns;
|
return returns;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user