From dcb6a0425c1c902555fac43441c0581afb2defd4 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Wed, 23 Nov 2022 09:55:46 +0000 Subject: [PATCH] override force opaque rule on keybind --- src/Window.cpp | 6 ++++-- src/Window.hpp | 1 + src/managers/KeybindManager.cpp | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Window.cpp b/src/Window.cpp index e98193e1..f13cb6d1 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -318,7 +318,8 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { } else if (r.szRule == "noshadow") { m_sAdditionalConfigData.forceNoShadow = true; } else if (r.szRule == "opaque") { - m_sAdditionalConfigData.forceOpaque = true; + if (!m_sAdditionalConfigData.forceOpaqueOverriden) + m_sAdditionalConfigData.forceOpaque = true; } else if (r.szRule.find("rounding") == 0) { try { m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1)); @@ -369,7 +370,8 @@ void CWindow::updateDynamicRules() { m_sAdditionalConfigData.forceNoBlur = false; m_sAdditionalConfigData.forceNoBorder = false; m_sAdditionalConfigData.forceNoShadow = false; - m_sAdditionalConfigData.forceOpaque = false; + if (!m_sAdditionalConfigData.forceOpaqueOverriden) + m_sAdditionalConfigData.forceOpaque = false; m_sAdditionalConfigData.forceNoAnims = false; m_sAdditionalConfigData.animationStyle = ""; m_sAdditionalConfigData.rounding = -1; diff --git a/src/Window.hpp b/src/Window.hpp index b0014af9..09ad5f48 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -32,6 +32,7 @@ struct SWindowAdditionalConfigData { int rounding = -1; // -1 means no bool forceNoBlur = false; bool forceOpaque = false; + bool forceOpaqueOverriden = false; // if true, a rule will not change the forceOpaque state. This is for the force opaque dispatcher. bool forceAllowsInput = false; bool forceNoAnims = false; bool forceNoBorder = false; diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index cb44e5ea..5ac399c7 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1622,6 +1622,7 @@ void CKeybindManager::toggleOpaque(std::string unused) { return; PWINDOW->m_sAdditionalConfigData.forceOpaque = !PWINDOW->m_sAdditionalConfigData.forceOpaque; + PWINDOW->m_sAdditionalConfigData.forceOpaqueOverriden = true; g_pHyprRenderer->damageWindow(PWINDOW); }