diff --git a/src/config/legacy/ConfigManager.cpp b/src/config/legacy/ConfigManager.cpp index e4c485e03..3b397b42d 100644 --- a/src/config/legacy/ConfigManager.cpp +++ b/src/config/legacy/ConfigManager.cpp @@ -965,13 +965,6 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) { w->uncacheWindowDecos(); } - static auto PZOOMFACTOR = CConfigValue("cursor:zoom_factor"); - for (auto const& m : g_pCompositor->m_monitors) { - *(m->m_cursorZoom) = *PZOOMFACTOR; - if (m->m_activeWorkspace) - m->m_activeWorkspace->m_space->recalculate(); - } - // Update the keyboard layout to the cfg'd one if this is not the first launch if (!m_isFirstLaunch) { g_pInputManager->setKeyboardLayout(); @@ -1074,6 +1067,8 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) { // update layouts Layout::Supplementary::algoMatcher()->updateWorkspaceLayouts(); + Config::Supplementary::refresher()->scheduleRefresh(Supplementary::REFRESH_ALL); + Event::bus()->m_events.config.reloaded.emit(); if (g_pEventManager) g_pEventManager->postEvent(SHyprIPCEvent{"configreloaded", ""}); diff --git a/src/config/lua/ConfigManager.cpp b/src/config/lua/ConfigManager.cpp index b4fc791d5..685f925f4 100644 --- a/src/config/lua/ConfigManager.cpp +++ b/src/config/lua/ConfigManager.cpp @@ -476,8 +476,6 @@ void CConfigManager::reload() { } void CConfigManager::postConfigReload() { - - static auto PZOOMFACTOR = CConfigValue("cursor.zoom_factor"); static auto PSUPPRESSERRORS = CConfigValue("debug.suppress_errors"); static auto PXWAYLAND = CConfigValue("xwayland.enabled"); static auto PMANUALCRASH = CConfigValue("debug.manual_crash"); @@ -490,12 +488,6 @@ void CConfigManager::postConfigReload() { w->uncacheWindowDecos(); } - for (auto const& m : g_pCompositor->m_monitors) { - *(m->m_cursorZoom) = *PZOOMFACTOR; - if (m->m_activeWorkspace) - m->m_activeWorkspace->m_space->recalculate(); - } - // Update the keyboard layout to the cfg'd one if this is not the first launch if (!m_isFirstLaunch) { g_pInputManager->setKeyboardLayout(); @@ -611,6 +603,8 @@ void CConfigManager::postConfigReload() { Layout::Supplementary::algoMatcher()->updateWorkspaceLayouts(); + Config::Supplementary::refresher()->scheduleRefresh(Supplementary::REFRESH_ALL); + Event::bus()->m_events.config.reloaded.emit(); if (g_pEventManager) g_pEventManager->postEvent(SHyprIPCEvent{"configreloaded", ""}); diff --git a/src/config/supplementary/propRefresher/PropRefresher.cpp b/src/config/supplementary/propRefresher/PropRefresher.cpp index 909624a07..0715594b6 100644 --- a/src/config/supplementary/propRefresher/PropRefresher.cpp +++ b/src/config/supplementary/propRefresher/PropRefresher.cpp @@ -6,6 +6,7 @@ #include "../../../Compositor.hpp" #include "../../../layout/supplementary/WorkspaceAlgoMatcher.hpp" #include "../../../layout/LayoutManager.hpp" +#include "../../../layout/space/Space.hpp" #include "../../../desktop/rule/Engine.hpp" #include "../../shared/monitor/MonitorRuleManager.hpp" @@ -19,6 +20,8 @@ UP& Supplementary::refresher() { } void CPropRefresher::scheduleRefresh(PropRefreshBits prop) { + static auto PZOOMFACTOR = CConfigValue("cursor.zoom_factor"); + m_propsTripped |= prop; if (!m_scheduled) { @@ -81,6 +84,14 @@ void CPropRefresher::scheduleRefresh(PropRefreshBits prop) { } } + if (m_propsTripped & REFRESH_CURSOR_ZOOMS) { + for (auto const& m : g_pCompositor->m_monitors) { + *(m->m_cursorZoom) = *PZOOMFACTOR; + if (m->m_activeWorkspace) + m->m_activeWorkspace->m_space->recalculate(); + } + } + m_scheduled = false; m_propsTripped = 0; }); diff --git a/src/config/supplementary/propRefresher/PropRefresher.hpp b/src/config/supplementary/propRefresher/PropRefresher.hpp index 563b33a2f..e8094753a 100644 --- a/src/config/supplementary/propRefresher/PropRefresher.hpp +++ b/src/config/supplementary/propRefresher/PropRefresher.hpp @@ -14,6 +14,9 @@ namespace Config::Supplementary { REFRESH_RULES = (1 << 4), REFRESH_WINDOW_STATES = (1 << 5) | REFRESH_RULES, REFRESH_MONITOR_STATES = (1 << 6) | REFRESH_LAYOUTS, + REFRESH_CURSOR_ZOOMS = (1 << 7), + + REFRESH_ALL = std::numeric_limits>::max(), }; using PropRefreshBits = std::underlying_type_t; diff --git a/src/config/values/ConfigValues.cpp b/src/config/values/ConfigValues.cpp index 2c44b1722..ff23ab5d3 100644 --- a/src/config/values/ConfigValues.cpp +++ b/src/config/values/ConfigValues.cpp @@ -559,7 +559,7 @@ std::vector> Values::getConfigValues() { MS("cursor:warp_on_toggle_special", "Move the cursor to the last focused window when toggling a special workspace.", 0, {.min = 0, .max = 2, .map = OptionMap{{"disable", 0}, {"enable", 1}, {"force", 2}}}), MS("cursor:default_monitor", "the name of a default monitor for the cursor to be set to on startup", STRVAL_EMPTY), - MS("cursor:zoom_factor", "the factor to zoom by around the cursor. 1 means no zoom.", 1, {.min = 1, .max = 10}), + MS("cursor:zoom_factor", "the factor to zoom by around the cursor. 1 means no zoom.", 1, {.min = 1, .max = 10, .refresh = Supplementary::REFRESH_CURSOR_ZOOMS}), MS("cursor:zoom_rigid", "whether the zoom should follow the cursor rigidly or loosely", false), MS("cursor:zoom_disable_aa", "If enabled, when zooming, no antialiasing will be used", false), MS("cursor:zoom_detached_camera", "Detaches the camera from the mouse when zoomed in", true),