summaryrefslogtreecommitdiff
path: root/hyprtester/plugin/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hyprtester/plugin/src/main.cpp')
-rw-r--r--hyprtester/plugin/src/main.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/hyprtester/plugin/src/main.cpp b/hyprtester/plugin/src/main.cpp
index 72120eac..cbc06723 100644
--- a/hyprtester/plugin/src/main.cpp
+++ b/hyprtester/plugin/src/main.cpp
@@ -14,6 +14,7 @@
#include <src/desktop/rule/windowRule/WindowRuleEffectContainer.hpp>
#include <src/desktop/rule/windowRule/WindowRuleApplicator.hpp>
#include <src/Compositor.hpp>
+#include <src/desktop/state/FocusState.hpp>
#undef private
#include <hyprutils/utils/ScopeGuard.hpp>
@@ -45,7 +46,7 @@ static SDispatchResult test(std::string in) {
// Trigger a snap move event for the active window
static SDispatchResult snapMove(std::string in) {
- const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
+ const auto PLASTWINDOW = Desktop::focusState()->window();
if (!PLASTWINDOW->m_isFloating)
return {.success = false, .error = "Window must be floating"};
@@ -259,13 +260,15 @@ static SDispatchResult addRule(std::string in) {
}
static SDispatchResult checkRule(std::string in) {
- if (!g_pCompositor->m_lastWindow)
+ const auto PLASTWINDOW = Desktop::focusState()->window();
+
+ if (!PLASTWINDOW)
return {.success = false, .error = "No window"};
- if (!g_pCompositor->m_lastWindow->m_ruleApplicator->m_otherProps.props.contains(ruleIDX))
+ if (!PLASTWINDOW->m_ruleApplicator->m_otherProps.props.contains(ruleIDX))
return {.success = false, .error = "No rule"};
- if (g_pCompositor->m_lastWindow->m_ruleApplicator->m_otherProps.props[ruleIDX]->effect != "effect")
+ if (PLASTWINDOW->m_ruleApplicator->m_otherProps.props[ruleIDX]->effect != "effect")
return {.success = false, .error = "Effect isn't \"effect\""};
return {};