From e8d2380c576d89dec8c2e0609066722a3cdf965c Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 14 Nov 2025 00:38:05 +0000 Subject: [PATCH] tests --- hyprtester/src/tests/main/window.cpp | 2 +- hyprtester/src/tests/main/workspaces.cpp | 2 +- src/config/ConfigManager.cpp | 3 +++ src/debug/HyprCtl.cpp | 4 ++++ src/debug/HyprCtl.hpp | 7 ++++--- .../rule/windowRule/WindowRuleApplicator.cpp | 16 ++++++++-------- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/hyprtester/src/tests/main/window.cpp b/hyprtester/src/tests/main/window.cpp index 80cd36b62..b17282f18 100644 --- a/hyprtester/src/tests/main/window.cpp +++ b/hyprtester/src/tests/main/window.cpp @@ -305,7 +305,7 @@ static bool test() { OK(getFromSocket("/keyword windowrule[wr-kitty-stuff]:opacity 0.5 0.5 override")); { - auto str = getFromSocket("/getprop active active_opacity"); + auto str = getFromSocket("/getprop active opacity"); EXPECT_CONTAINS(str, "0.5"); } diff --git a/hyprtester/src/tests/main/workspaces.cpp b/hyprtester/src/tests/main/workspaces.cpp index def35d088..9d3802816 100644 --- a/hyprtester/src/tests/main/workspaces.cpp +++ b/hyprtester/src/tests/main/workspaces.cpp @@ -27,7 +27,7 @@ static bool test() { // test on workspace "window" NLog::log("{}Switching to workspace 1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace 1")); + getFromSocket("/dispatch workspace 1"); NLog::log("{}Checking persistent no-mon", Colors::YELLOW); OK(getFromSocket("r/keyword workspace 966,persistent:1")); diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 88243824e..06a829a1a 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -16,6 +16,7 @@ #include "../desktop/rule/Engine.hpp" #include "../desktop/rule/windowRule/WindowRule.hpp" #include "../desktop/rule/layerRule/LayerRule.hpp" +#include "../debug/HyprCtl.hpp" #include "defaultConfig.hpp" #include "../render/Renderer.hpp" @@ -2859,6 +2860,8 @@ std::optional CConfigManager::handleWindowrule(const std::string& c } m_keywordRules.emplace_back(std::move(rule)); + if (g_pHyprCtl->m_currentRequestParams.isDynamicKeyword) + Desktop::Rule::ruleEngine()->registerRule(SP{m_keywordRules.back()}); return std::nullopt; } diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index e88d3d6e0..82a697157 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -1273,8 +1273,12 @@ static std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) if (COMMAND.empty()) return "Invalid input: command is empty"; + g_pHyprCtl->m_currentRequestParams.isDynamicKeyword = true; + std::string retval = g_pConfigManager->parseKeyword(COMMAND, VALUE); + g_pHyprCtl->m_currentRequestParams.isDynamicKeyword = false; + // if we are executing a dynamic source we have to reload everything, so every if will have a check for source. if (COMMAND == "monitor" || COMMAND == "source") g_pConfigManager->m_wantsMonitorReload = true; // for monitor keywords diff --git a/src/debug/HyprCtl.hpp b/src/debug/HyprCtl.hpp index 95bb65b8c..d4f7aa149 100644 --- a/src/debug/HyprCtl.hpp +++ b/src/debug/HyprCtl.hpp @@ -25,9 +25,10 @@ class CHyprCtl { Hyprutils::OS::CFileDescriptor m_socketFD; struct { - bool all = false; - bool sysInfoConfig = false; - pid_t pid = 0; + bool all = false; + bool sysInfoConfig = false; + bool isDynamicKeyword = false; + pid_t pid = 0; SP> pendingPromise; } m_currentRequestParams; diff --git a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp index 469b7dd22..03c71dda8 100644 --- a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp +++ b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp @@ -424,19 +424,19 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyStaticRule(const } case WINDOW_RULE_EFFECT_FLOAT: { - static_.floating = true; + static_.floating = truthy(effect); break; } case WINDOW_RULE_EFFECT_TILE: { - static_.floating = false; + static_.floating = !truthy(effect); break; } case WINDOW_RULE_EFFECT_FULLSCREEN: { - static_.fullscreen = true; + static_.fullscreen = truthy(effect); break; } case WINDOW_RULE_EFFECT_MAXIMIZE: { - static_.maximize = true; + static_.maximize = truthy(effect); break; } case WINDOW_RULE_EFFECT_FULLSCREENSTATE: { @@ -457,11 +457,11 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyStaticRule(const break; } case WINDOW_RULE_EFFECT_CENTER: { - static_.center = true; + static_.center = truthy(effect); break; } case WINDOW_RULE_EFFECT_PSEUDO: { - static_.pseudo = true; + static_.pseudo = truthy(effect); break; } case WINDOW_RULE_EFFECT_MONITOR: { @@ -473,11 +473,11 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyStaticRule(const break; } case WINDOW_RULE_EFFECT_NOINITIALFOCUS: { - static_.noInitialFocus = true; + static_.noInitialFocus = truthy(effect); break; } case WINDOW_RULE_EFFECT_PIN: { - static_.pin = true; + static_.pin = truthy(effect); break; } case WINDOW_RULE_EFFECT_GROUP: {