mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-05 16:18:01 +02:00
parent
3cf62bea18
commit
a4ecae9160
3 changed files with 30 additions and 2 deletions
|
|
@ -658,6 +658,33 @@ static bool testWindowRuleWorkspaceEmpty() {
|
|||
return true;
|
||||
}
|
||||
|
||||
static void testContentRules() {
|
||||
NLog::log("{}Testing content window rules", Colors::YELLOW);
|
||||
|
||||
// kill me PLEASE
|
||||
|
||||
OK(getFromSocket("/keyword windowrule match:class kitty_bitch, content game"));
|
||||
OK(getFromSocket("/keyword windowrule match:content game, border_size 10"));
|
||||
OK(getFromSocket("/keyword windowrule match:content 3, opacity 0.5"));
|
||||
|
||||
getFromSocket("/dispatch workspace 420");
|
||||
|
||||
if (!spawnKitty("kitty_bitch")) {
|
||||
NLog::log("{}Error: failed to spawn kitty", Colors::RED);
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
auto res = getFromSocket("/getprop active border_size");
|
||||
EXPECT_CONTAINS(res, "10");
|
||||
}
|
||||
|
||||
{
|
||||
auto res = getFromSocket("/getprop active opacity");
|
||||
EXPECT_CONTAINS(res, "0.5");
|
||||
}
|
||||
}
|
||||
|
||||
static bool test() {
|
||||
NLog::log("{}Testing windows", Colors::GREEN);
|
||||
|
||||
|
|
@ -1122,6 +1149,7 @@ static bool test() {
|
|||
testWindowRuleFocusOnActivate();
|
||||
testPinnedWorkspacesValid();
|
||||
testWindowRuleWorkspaceEmpty();
|
||||
testContentRules();
|
||||
|
||||
NLog::log("{}Reloading config", Colors::YELLOW);
|
||||
OK(getFromSocket("/reload"));
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static const std::unordered_map<eRuleProperty, eRuleMatchEngine> RULE_ENGINES =
|
|||
{RULE_PROP_FULLSCREENSTATE_INTERNAL, RULE_MATCH_ENGINE_INT}, //
|
||||
{RULE_PROP_FULLSCREENSTATE_CLIENT, RULE_MATCH_ENGINE_INT}, //
|
||||
{RULE_PROP_ON_WORKSPACE, RULE_MATCH_ENGINE_WORKSPACE}, //
|
||||
{RULE_PROP_CONTENT, RULE_MATCH_ENGINE_INT}, //
|
||||
{RULE_PROP_CONTENT, RULE_MATCH_ENGINE_REGEX}, //
|
||||
{RULE_PROP_XDG_TAG, RULE_MATCH_ENGINE_REGEX}, //
|
||||
{RULE_PROP_NAMESPACE, RULE_MATCH_ENGINE_REGEX}, //
|
||||
{RULE_PROP_EXEC_TOKEN, RULE_MATCH_ENGINE_REGEX}, //
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ bool CWindowRule::matches(PHLWINDOW w, bool allowEnvLookup) {
|
|||
return false;
|
||||
break;
|
||||
case RULE_PROP_CONTENT:
|
||||
if (!engine->match(w->getContentType()) && !engine->match(NContentType::toString(w->getContentType())))
|
||||
if (!engine->match(std::format("{}", sc<size_t>(w->getContentType()))) && !engine->match(NContentType::toString(w->getContentType())))
|
||||
return false;
|
||||
break;
|
||||
case RULE_PROP_XDG_TAG:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue