From 2a3429d4cfdc01794b9d6fc1b49be1da019b5606 Mon Sep 17 00:00:00 2001 From: Epilepsy Gatherings <73647246+phonetic112@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:07:19 -0500 Subject: internal: add `forcenofocus` prop (#4672) * add forcenofocus * change nofocus to overridable var --- src/debug/HyprCtl.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/debug/HyprCtl.cpp') diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index de2aaeb8..08957750 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -1084,7 +1084,8 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) { if (vars.size() < 4) return "not enough args"; - const auto PWINDOW = g_pCompositor->getWindowByRegex(vars[1]); + const auto PLASTWINDOW = g_pCompositor->m_pLastWindow; + const auto PWINDOW = g_pCompositor->getWindowByRegex(vars[1]); if (!PWINDOW) return "window not found"; @@ -1092,6 +1093,8 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) { const auto PROP = vars[2]; const auto VAL = vars[3]; + auto noFocus = PWINDOW->m_sAdditionalConfigData.noFocus; + bool lock = false; if (vars.size() > 4) { @@ -1121,6 +1124,8 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) { PWINDOW->m_sAdditionalConfigData.forceNoShadow.forceSetIgnoreLocked(configStringToInt(VAL), lock); } else if (PROP == "forcenodim") { PWINDOW->m_sAdditionalConfigData.forceNoDim.forceSetIgnoreLocked(configStringToInt(VAL), lock); + } else if (PROP == "nofocus") { + PWINDOW->m_sAdditionalConfigData.noFocus.forceSetIgnoreLocked(configStringToInt(VAL), lock); } else if (PROP == "windowdancecompat") { PWINDOW->m_sAdditionalConfigData.windowDanceCompat.forceSetIgnoreLocked(configStringToInt(VAL), lock); } else if (PROP == "nomaxsize") { @@ -1156,6 +1161,12 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) { g_pCompositor->updateAllWindowsAnimatedDecorationValues(); + if (!(PWINDOW->m_sAdditionalConfigData.noFocus.toUnderlying() == noFocus.toUnderlying())) { + g_pCompositor->focusWindow(nullptr); + g_pCompositor->focusWindow(PWINDOW); + g_pCompositor->focusWindow(PLASTWINDOW); + } + for (auto& m : g_pCompositor->m_vMonitors) g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID); -- cgit v1.2.3