diff options
| author | EvilLary <EvilLary@proton.me> | 2026-01-06 16:29:17 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-06 14:29:17 +0100 |
| commit | cbfbd9712a7218b6d39b4e9d93d0941eb0572783 (patch) | |
| tree | adc1e519d80c8a1d9f1c11d7e6e122c4900d380d /src/helpers | |
| parent | 9817553c664b0b7f6776671383a6368c74ee8dee (diff) | |
anr: open anr dialog on parent's workspace (#12509)
Diffstat (limited to 'src/helpers')
| -rw-r--r-- | src/helpers/AsyncDialogBox.cpp | 11 | ||||
| -rw-r--r-- | src/helpers/AsyncDialogBox.hpp | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/helpers/AsyncDialogBox.cpp b/src/helpers/AsyncDialogBox.cpp index 4cef4252..8c2c7cd7 100644 --- a/src/helpers/AsyncDialogBox.cpp +++ b/src/helpers/AsyncDialogBox.cpp @@ -4,6 +4,8 @@ #include <algorithm> #include <unistd.h> #include "../managers/eventLoop/EventLoopManager.hpp" +#include "../desktop/rule/windowRule/WindowRule.hpp" +#include "../desktop/rule/Engine.hpp" using namespace Hyprutils::OS; @@ -119,6 +121,9 @@ SP<CPromise<std::string>> CAsyncDialogBox::open() { m_selfReference = m_selfWeakReference.lock(); + if (!m_execRuleToken.empty()) + proc.addEnv(Desktop::Rule::EXEC_RULE_ENV_NAME, m_execRuleToken); + if (!proc.runAsync()) { Log::logger->log(Log::ERR, "CAsyncDialogBox::open: failed to run async"); wl_event_source_remove(m_readEventSource); @@ -154,3 +159,9 @@ pid_t CAsyncDialogBox::getPID() const { SP<CAsyncDialogBox> CAsyncDialogBox::lockSelf() { return m_selfWeakReference.lock(); } + +void CAsyncDialogBox::setExecRule(std::string&& s) { + auto rule = Desktop::Rule::CWindowRule::buildFromExecString(std::move(s)); + m_execRuleToken = rule->execToken(); + Desktop::Rule::ruleEngine()->registerRule(std::move(rule)); +} diff --git a/src/helpers/AsyncDialogBox.hpp b/src/helpers/AsyncDialogBox.hpp index 8db516ce..1bdeba14 100644 --- a/src/helpers/AsyncDialogBox.hpp +++ b/src/helpers/AsyncDialogBox.hpp @@ -27,6 +27,7 @@ class CAsyncDialogBox { void kill(); bool isRunning() const; pid_t getPID() const; + void setExecRule(std::string&& s); SP<CAsyncDialogBox> lockSelf(); @@ -41,7 +42,8 @@ class CAsyncDialogBox { pid_t m_dialogPid = 0; wl_event_source* m_readEventSource = nullptr; Hyprutils::OS::CFileDescriptor m_pipeReadFd; - std::string m_stdout = ""; + std::string m_stdout = ""; + std::string m_execRuleToken = ""; const std::string m_title; const std::string m_description; |
