override force opaque rule on keybind

This commit is contained in:
Vaxry 2022-11-23 09:55:46 +00:00
parent e15a9f3d7d
commit dcb6a0425c
3 changed files with 6 additions and 2 deletions

View file

@ -318,6 +318,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
} else if (r.szRule == "noshadow") { } else if (r.szRule == "noshadow") {
m_sAdditionalConfigData.forceNoShadow = true; m_sAdditionalConfigData.forceNoShadow = true;
} else if (r.szRule == "opaque") { } else if (r.szRule == "opaque") {
if (!m_sAdditionalConfigData.forceOpaqueOverriden)
m_sAdditionalConfigData.forceOpaque = true; m_sAdditionalConfigData.forceOpaque = true;
} else if (r.szRule.find("rounding") == 0) { } else if (r.szRule.find("rounding") == 0) {
try { try {
@ -369,6 +370,7 @@ void CWindow::updateDynamicRules() {
m_sAdditionalConfigData.forceNoBlur = false; m_sAdditionalConfigData.forceNoBlur = false;
m_sAdditionalConfigData.forceNoBorder = false; m_sAdditionalConfigData.forceNoBorder = false;
m_sAdditionalConfigData.forceNoShadow = false; m_sAdditionalConfigData.forceNoShadow = false;
if (!m_sAdditionalConfigData.forceOpaqueOverriden)
m_sAdditionalConfigData.forceOpaque = false; m_sAdditionalConfigData.forceOpaque = false;
m_sAdditionalConfigData.forceNoAnims = false; m_sAdditionalConfigData.forceNoAnims = false;
m_sAdditionalConfigData.animationStyle = ""; m_sAdditionalConfigData.animationStyle = "";

View file

@ -32,6 +32,7 @@ struct SWindowAdditionalConfigData {
int rounding = -1; // -1 means no int rounding = -1; // -1 means no
bool forceNoBlur = false; bool forceNoBlur = false;
bool forceOpaque = 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 forceAllowsInput = false;
bool forceNoAnims = false; bool forceNoAnims = false;
bool forceNoBorder = false; bool forceNoBorder = false;

View file

@ -1622,6 +1622,7 @@ void CKeybindManager::toggleOpaque(std::string unused) {
return; return;
PWINDOW->m_sAdditionalConfigData.forceOpaque = !PWINDOW->m_sAdditionalConfigData.forceOpaque; PWINDOW->m_sAdditionalConfigData.forceOpaque = !PWINDOW->m_sAdditionalConfigData.forceOpaque;
PWINDOW->m_sAdditionalConfigData.forceOpaqueOverriden = true;
g_pHyprRenderer->damageWindow(PWINDOW); g_pHyprRenderer->damageWindow(PWINDOW);
} }