From 5ba33f846129f3e6c0505b19f94634b24505e828 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sun, 26 Apr 2026 15:16:36 +0100 Subject: config/lua: init lua config manager, use lua if available (#13817) Adds a new lua config manager, which will automatically be used if there is a lua config present. --- src/Compositor.cpp | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index f823b62c..f0261847 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2,6 +2,7 @@ #include #include "Compositor.hpp" +#include "config/supplementary/executor/Executor.hpp" #include "debug/log/Logger.hpp" #include "desktop/DesktopTypes.hpp" #include "desktop/state/FocusState.hpp" @@ -534,7 +535,7 @@ void CCompositor::cleanEnvironment() { "dbus-update-activation-environment 2>/dev/null && " #endif "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS"; - CKeybindManager::spawn(CMD); + Config::Supplementary::executor()->spawn(CMD); } } @@ -652,6 +653,9 @@ void CCompositor::initManagers(eManagersInitStage stage) { Log::logger->log(Log::DEBUG, "Creating the TokenManager!"); g_pTokenManager = makeUnique(); + // create executor + Config::Supplementary::executor(); + Config::mgr()->init(); Log::logger->log(Log::DEBUG, "Creating the PointerManager!"); @@ -781,7 +785,7 @@ void CCompositor::startCompositor() { "dbus-update-activation-environment 2>/dev/null && " #endif "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS"; - CKeybindManager::spawn(CMD); + Config::Supplementary::executor()->spawn(CMD); } Log::logger->log(Log::DEBUG, "Running on WAYLAND_DISPLAY: {}", m_wlDisplaySocket); @@ -900,12 +904,12 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint16_t prope if (!PMONITOR) return nullptr; - static auto PRESIZEONBORDER = CConfigValue("general:resize_on_border"); - static auto PBORDERSIZE = CConfigValue("general:border_size"); - static auto PBORDERGRABEXTEND = CConfigValue("general:extend_border_grab_area"); - static auto PSPECIALFALLTHRU = CConfigValue("input:special_fallthrough"); - static auto PMODALPARENTBLOCKING = CConfigValue("general:modal_parent_blocking"); - static auto PFOLLOWMOUSESHRINK = CConfigValue("input:follow_mouse_shrink"); + static auto PRESIZEONBORDER = CConfigValue("general:resize_on_border"); + static auto PBORDERSIZE = CConfigValue("general:border_size"); + static auto PBORDERGRABEXTEND = CConfigValue("general:extend_border_grab_area"); + static auto PSPECIALFALLTHRU = CConfigValue("input:special_fallthrough"); + static auto PMODALPARENTBLOCKING = CConfigValue("general:modal_parent_blocking"); + static auto PFOLLOWMOUSESHRINK = CConfigValue("input:follow_mouse_shrink"); const auto BORDER_GRAB_AREA = *PRESIZEONBORDER ? *PBORDERSIZE + *PBORDERGRABEXTEND : 0; const bool ONLY_PRIORITY = properties & Desktop::View::FOCUS_PRIORITY; const bool FOLLOW_MOUSE_CHECK = properties & Desktop::View::FOLLOW_MOUSE_CHECK; @@ -1470,8 +1474,8 @@ PHLWINDOW CCompositor::getWindowInDirection(const CBox& box, PHLWORKSPACE pWorks return nullptr; // 0 -> history, 1 -> shared length - static auto PMETHOD = CConfigValue("binds:focus_preferred_method"); - static auto PMONITORFALLBACK = CConfigValue("binds:window_direction_monitor_fallback"); + static auto PMETHOD = CConfigValue("binds:focus_preferred_method"); + static auto PMONITORFALLBACK = CConfigValue("binds:window_direction_monitor_fallback"); const auto POSA = box.pos(); const auto SIZEA = box.size(); @@ -1729,7 +1733,7 @@ bool CCompositor::isPointOnReservedArea(const Vector2D& point, const PHLMONITOR } std::optional CCompositor::calculateX11WorkArea() { - static auto PXWLFORCESCALEZERO = CConfigValue("xwayland:force_zero_scaling"); + static auto PXWLFORCESCALEZERO = CConfigValue("xwayland:force_zero_scaling"); // We more than likely won't be able to calculate one // and even if we could this is minor if (m_monitors.size() > 1 || m_monitors.empty()) @@ -2007,7 +2011,7 @@ PHLMONITOR CCompositor::getMonitorFromString(const std::string& name) { } void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, PHLMONITOR pMonitor, bool noWarpCursor) { - static auto PHIDESPECIALONWORKSPACECHANGE = CConfigValue("binds:hide_special_on_workspace_change"); + static auto PHIDESPECIALONWORKSPACECHANGE = CConfigValue("binds:hide_special_on_workspace_change"); if (!pWorkspace || !pMonitor) return; @@ -2181,8 +2185,8 @@ void CCompositor::setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFull } void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, Desktop::View::SFullscreenState state) { - static auto PDIRECTSCANOUT = CConfigValue("render:direct_scanout"); - static auto PALLOWPINFULLSCREEN = CConfigValue("binds:allow_pin_fullscreen"); + static auto PDIRECTSCANOUT = CConfigValue("render:direct_scanout"); + static auto PALLOWPINFULLSCREEN = CConfigValue("binds:allow_pin_fullscreen"); if (!validMapped(PWINDOW) || g_pCompositor->m_unsafeState) return; @@ -2428,7 +2432,7 @@ void CCompositor::warpCursorTo(const Vector2D& pos, bool force) { // warpCursorTo should only be used for warps that // should be disabled with no_warps - static auto PNOWARPS = CConfigValue("cursor:no_warps"); + static auto PNOWARPS = CConfigValue("cursor:no_warps"); if (*PNOWARPS && !force) { const auto PMONITORNEW = getMonitorFromVector(pos); @@ -2442,11 +2446,6 @@ void CCompositor::warpCursorTo(const Vector2D& pos, bool force) { Desktop::focusState()->rawMonitorFocus(PMONITORNEW); } -void CCompositor::closeWindow(PHLWINDOW pWindow) { - if (pWindow && validMapped(pWindow)) - g_pXWaylandManager->sendCloseWindow(pWindow); -} - PHLLS CCompositor::getLayerSurfaceFromSurface(SP pSurface) { std::pair, bool> result = {pSurface, false}; @@ -2576,9 +2575,9 @@ std::vector CCompositor::getWorkspacesCopy() { } void CCompositor::performUserChecks() { - static auto PNOCHECKXDG = CConfigValue("misc:disable_xdg_env_checks"); - static auto PNOCHECKGUIUTILS = CConfigValue("misc:disable_hyprland_guiutils_check"); - static auto PNOWATCHDOG = CConfigValue("misc:disable_watchdog_warning"); + static auto PNOCHECKXDG = CConfigValue("misc:disable_xdg_env_checks"); + static auto PNOCHECKGUIUTILS = CConfigValue("misc:disable_hyprland_guiutils_check"); + static auto PNOWATCHDOG = CConfigValue("misc:disable_watchdog_warning"); if (!*PNOCHECKXDG) { const auto CURRENT_DESKTOP_ENV = getenv("XDG_CURRENT_DESKTOP"); @@ -2674,7 +2673,7 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor pWindow->moveToWorkspace(pWorkspace); pWindow->m_monitor = pWorkspace->m_monitor; - static auto PGROUPONMOVETOWORKSPACE = CConfigValue("group:group_on_movetoworkspace"); + static auto PGROUPONMOVETOWORKSPACE = CConfigValue("group:group_on_movetoworkspace"); if (*PGROUPONMOVETOWORKSPACE && visibleWindowsOnWorkspace == 1 && pFirstWindowOnWorkspace && pFirstWindowOnWorkspace != pWindow && pFirstWindowOnWorkspace->m_group && pWindow->canBeGroupedInto(pFirstWindowOnWorkspace->m_group)) { pFirstWindowOnWorkspace->m_group->add(pWindow); @@ -2751,7 +2750,7 @@ void CCompositor::checkMonitorOverlaps() { } void CCompositor::arrangeMonitors() { - static auto PXWLFORCESCALEZERO = CConfigValue("xwayland:force_zero_scaling"); + static auto PXWLFORCESCALEZERO = CConfigValue("xwayland:force_zero_scaling"); std::vector toArrange(m_monitors.begin(), m_monitors.end()); std::vector arranged; -- cgit v1.2.3