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,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;

View file

@ -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;

View file

@ -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);
}