layerrules: add abovelock to render above lockscreen (#9793)

This commit is contained in:
Virt 2025-04-25 16:38:31 +02:00 committed by GitHub
parent 41f5f67f6c
commit 4cf62c114e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 71 additions and 24 deletions

View file

@ -5,7 +5,7 @@
#include "../debug/Log.hpp"
static const auto RULES = std::unordered_set<std::string>{"noanim", "blur", "blurpopups", "dimaround"};
static const auto RULES_PREFIX = std::unordered_set<std::string>{"ignorealpha", "ignorezero", "xray", "animation", "order"};
static const auto RULES_PREFIX = std::unordered_set<std::string>{"ignorealpha", "ignorezero", "xray", "animation", "order", "abovelock"};
CLayerRule::CLayerRule(const std::string& rule_, const std::string& ns_) : m_targetNamespace(ns_), m_rule(rule_) {
const bool VALID = RULES.contains(m_rule) || std::any_of(RULES_PREFIX.begin(), RULES_PREFIX.end(), [&rule_](const auto& prefix) { return rule_.starts_with(prefix); });
@ -31,8 +31,10 @@ CLayerRule::CLayerRule(const std::string& rule_, const std::string& ns_) : m_tar
m_ruleType = RULE_ANIMATION;
else if (m_rule.starts_with("order"))
m_ruleType = RULE_ORDER;
else if (m_rule.starts_with("abovelock"))
m_ruleType = RULE_ABOVELOCK;
else {
Debug::log(ERR, "CLayerRule: didn't match a rule that was found valid?!");
m_ruleType = RULE_INVALID;
}
}
}

View file

@ -14,6 +14,7 @@ class CLayerRule {
RULE_BLUR,
RULE_BLURPOPUPS,
RULE_DIMAROUND,
RULE_ABOVELOCK,
RULE_IGNOREALPHA,
RULE_IGNOREZERO,
RULE_XRAY,
@ -28,4 +29,4 @@ class CLayerRule {
const std::string m_rule;
CRuleRegexContainer m_targetNamespaceRegex;
};
};

View file

@ -421,9 +421,8 @@ void CLayerSurface::applyRules() {
}
case CLayerRule::RULE_XRAY: {
CVarList vars{rule->m_rule, 0, ' '};
try {
m_xray = configStringToInt(vars[1]).value_or(false);
} catch (...) {}
m_xray = configStringToInt(vars[1]).value_or(false);
break;
}
case CLayerRule::RULE_ANIMATION: {
@ -438,6 +437,14 @@ void CLayerSurface::applyRules() {
} catch (...) { Debug::log(ERR, "Invalid value passed to order"); }
break;
}
case CLayerRule::RULE_ABOVELOCK: {
m_aboveLockscreen = true;
CVarList vars{rule->m_rule, 0, ' '};
m_aboveLockscreenInteractable = configStringToInt(vars[1]).value_or(false);
break;
}
default: break;
}
}

View file

@ -43,13 +43,15 @@ class CLayerSurface {
bool m_noProcess = false;
bool m_noAnimations = false;
bool m_forceBlur = false;
bool m_forceBlurPopups = false;
int64_t m_xray = -1;
bool m_ignoreAlpha = false;
float m_ignoreAlphaValue = 0.f;
bool m_dimAround = false;
int64_t m_order = 0;
bool m_forceBlur = false;
bool m_forceBlurPopups = false;
int64_t m_xray = -1;
bool m_ignoreAlpha = false;
float m_ignoreAlphaValue = 0.f;
bool m_dimAround = false;
int64_t m_order = 0;
bool m_aboveLockscreen = false;
bool m_aboveLockscreenInteractable = false;
std::optional<std::string> m_animationStyle;