mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-09-05 19:08:18 +00:00
windowrules: Add novrr
dynamic window rule (#11370)
This commit is contained in:
@@ -1848,6 +1848,9 @@ void CConfigManager::ensureVRR(PHLMONITOR pMonitor) {
|
||||
return; // ???
|
||||
|
||||
bool wantVRR = PWORKSPACE->m_hasFullscreenWindow && (PWORKSPACE->m_fullscreenMode & FSMODE_FULLSCREEN);
|
||||
if (wantVRR && PWORKSPACE->getFullscreenWindow()->m_windowData.noVRR.valueOrDefault())
|
||||
wantVRR = false;
|
||||
|
||||
if (wantVRR && USEVRR == 3) {
|
||||
const auto contentType = PWORKSPACE->getFullscreenWindow()->getContentType();
|
||||
wantVRR = contentType == CONTENT_TYPE_GAME || contentType == CONTENT_TYPE_VIDEO;
|
||||
|
@@ -802,6 +802,10 @@ void CWindow::applyDynamicRule(const SP<CWindowRule>& r) {
|
||||
m_windowData.persistentSize = CWindowOverridableVar(true, PRIORITY_WINDOW_RULE);
|
||||
break;
|
||||
}
|
||||
case CWindowRule::RULE_NOVRR: {
|
||||
m_windowData.noVRR = CWindowOverridableVar(true, priority);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -821,6 +825,7 @@ void CWindow::updateDynamicRules() {
|
||||
m_windowData.inactiveBorderColor.unset(PRIORITY_WINDOW_RULE);
|
||||
|
||||
m_windowData.renderUnfocused.unset(PRIORITY_WINDOW_RULE);
|
||||
m_windowData.noVRR.unset(PRIORITY_WINDOW_RULE);
|
||||
|
||||
m_idleInhibitMode = IDLEINHIBIT_NONE;
|
||||
|
||||
|
@@ -105,6 +105,7 @@ struct SWindowData {
|
||||
CWindowOverridableVar<bool> renderUnfocused = false;
|
||||
CWindowOverridableVar<bool> noFollowMouse = false;
|
||||
CWindowOverridableVar<bool> noScreenShare = false;
|
||||
CWindowOverridableVar<bool> noVRR = false;
|
||||
|
||||
CWindowOverridableVar<Hyprlang::INT> borderSize = {std::string("general:border_size"), sc<Hyprlang::INT>(0), std::nullopt};
|
||||
CWindowOverridableVar<Hyprlang::INT> rounding = {std::string("decoration:rounding"), sc<Hyprlang::INT>(0), std::nullopt};
|
||||
@@ -488,6 +489,7 @@ namespace NWindowProperties {
|
||||
{"opaque", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.opaque; }},
|
||||
{"forcergbx", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.RGBX; }},
|
||||
{"syncfullscreen", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.syncFullscreen; }},
|
||||
{"novrr", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noVRR; }},
|
||||
{"immediate", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.tearing; }},
|
||||
{"xray", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.xray; }},
|
||||
{"nofollowmouse", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noFollowMouse; }},
|
||||
|
@@ -10,7 +10,7 @@ static const auto RULES = std::unordered_set<std::string>{
|
||||
static const auto RULES_PREFIX = std::unordered_set<std::string>{
|
||||
"animation", "bordercolor", "bordersize", "center", "content", "fullscreenstate", "group", "idleinhibit", "maxsize", "minsize", "monitor",
|
||||
"move", "noclosefor", "opacity", "plugin:", "prop", "pseudo", "rounding", "roundingpower", "scrollmouse", "scrolltouchpad", "size",
|
||||
"suppressevent", "tag", "workspace", "xray",
|
||||
"suppressevent", "tag", "workspace", "xray", "novrr",
|
||||
};
|
||||
|
||||
CWindowRule::CWindowRule(const std::string& rule, const std::string& value, bool isV2, bool isExecRule) : m_value(value), m_rule(rule), m_v2(isV2), m_execRule(isExecRule) {
|
||||
@@ -70,6 +70,8 @@ CWindowRule::CWindowRule(const std::string& rule, const std::string& value, bool
|
||||
m_ruleType = RULE_SIZE;
|
||||
else if (rule.starts_with("suppressevent"))
|
||||
m_ruleType = RULE_SUPPRESSEVENT;
|
||||
else if (rule.starts_with("novrr"))
|
||||
m_ruleType = RULE_NOVRR;
|
||||
else if (rule.starts_with("tag"))
|
||||
m_ruleType = RULE_TAG;
|
||||
else if (rule.starts_with("workspace"))
|
||||
|
@@ -39,6 +39,7 @@ class CWindowRule {
|
||||
RULE_CONTENT,
|
||||
RULE_PERSISTENTSIZE,
|
||||
RULE_NOCLOSEFOR,
|
||||
RULE_NOVRR,
|
||||
};
|
||||
|
||||
eRuleType m_ruleType = RULE_INVALID;
|
||||
|
@@ -321,6 +321,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||
try {
|
||||
PWINDOW->m_closeableSince = Time::steadyNow() + std::chrono::milliseconds(std::stoull(VARS[1]));
|
||||
} catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r->m_rule, e.what()); }
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
|
@@ -3250,6 +3250,9 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
|
||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||
}
|
||||
|
||||
if (PROP == "novrr")
|
||||
g_pConfigManager->ensureVRR(PWINDOW->m_monitor.lock());
|
||||
|
||||
for (auto const& m : g_pCompositor->m_monitors)
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->m_id);
|
||||
|
||||
|
Reference in New Issue
Block a user