This commit is contained in:
Vaxry 2025-11-14 00:38:05 +00:00 committed by Mihai Fufezan
parent 9df5145a6e
commit e8d2380c57
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
6 changed files with 21 additions and 13 deletions

View file

@ -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");
}

View file

@ -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"));

View file

@ -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<std::string> CConfigManager::handleWindowrule(const std::string& c
}
m_keywordRules.emplace_back(std::move(rule));
if (g_pHyprCtl->m_currentRequestParams.isDynamicKeyword)
Desktop::Rule::ruleEngine()->registerRule(SP<Desktop::Rule::IRule>{m_keywordRules.back()});
return std::nullopt;
}

View file

@ -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

View file

@ -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<CPromise<std::string>> pendingPromise;
} m_currentRequestParams;

View file

@ -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: {