diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-04-26 15:16:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-26 15:16:36 +0100 |
| commit | 5ba33f846129f3e6c0505b19f94634b24505e828 (patch) | |
| tree | aaacabe678006040c342935481a86607c66607fd /src/Compositor.cpp | |
| parent | 329b2b356dd92ac07f4e2aa69cbce82ee9ba9d19 (diff) | |
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.
Diffstat (limited to 'src/Compositor.cpp')
| -rw-r--r-- | src/Compositor.cpp | 49 |
1 files changed, 24 insertions, 25 deletions
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 <re2/re2.h> #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<CTokenManager>(); + // 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<Hyprlang::INT>("general:resize_on_border"); - static auto PBORDERSIZE = CConfigValue<Hyprlang::INT>("general:border_size"); - static auto PBORDERGRABEXTEND = CConfigValue<Hyprlang::INT>("general:extend_border_grab_area"); - static auto PSPECIALFALLTHRU = CConfigValue<Hyprlang::INT>("input:special_fallthrough"); - static auto PMODALPARENTBLOCKING = CConfigValue<Hyprlang::INT>("general:modal_parent_blocking"); - static auto PFOLLOWMOUSESHRINK = CConfigValue<Hyprlang::INT>("input:follow_mouse_shrink"); + static auto PRESIZEONBORDER = CConfigValue<Config::INTEGER>("general:resize_on_border"); + static auto PBORDERSIZE = CConfigValue<Config::INTEGER>("general:border_size"); + static auto PBORDERGRABEXTEND = CConfigValue<Config::INTEGER>("general:extend_border_grab_area"); + static auto PSPECIALFALLTHRU = CConfigValue<Config::INTEGER>("input:special_fallthrough"); + static auto PMODALPARENTBLOCKING = CConfigValue<Config::INTEGER>("general:modal_parent_blocking"); + static auto PFOLLOWMOUSESHRINK = CConfigValue<Config::INTEGER>("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<Hyprlang::INT>("binds:focus_preferred_method"); - static auto PMONITORFALLBACK = CConfigValue<Hyprlang::INT>("binds:window_direction_monitor_fallback"); + static auto PMETHOD = CConfigValue<Config::INTEGER>("binds:focus_preferred_method"); + static auto PMONITORFALLBACK = CConfigValue<Config::INTEGER>("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<CBox> CCompositor::calculateX11WorkArea() { - static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling"); + static auto PXWLFORCESCALEZERO = CConfigValue<Config::INTEGER>("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<Hyprlang::INT>("binds:hide_special_on_workspace_change"); + static auto PHIDESPECIALONWORKSPACECHANGE = CConfigValue<Config::INTEGER>("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<Hyprlang::INT>("render:direct_scanout"); - static auto PALLOWPINFULLSCREEN = CConfigValue<Hyprlang::INT>("binds:allow_pin_fullscreen"); + static auto PDIRECTSCANOUT = CConfigValue<Config::INTEGER>("render:direct_scanout"); + static auto PALLOWPINFULLSCREEN = CConfigValue<Config::INTEGER>("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<Hyprlang::INT>("cursor:no_warps"); + static auto PNOWARPS = CConfigValue<Config::INTEGER>("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<CWLSurfaceResource> pSurface) { std::pair<SP<CWLSurfaceResource>, bool> result = {pSurface, false}; @@ -2576,9 +2575,9 @@ std::vector<PHLWORKSPACE> CCompositor::getWorkspacesCopy() { } void CCompositor::performUserChecks() { - static auto PNOCHECKXDG = CConfigValue<Hyprlang::INT>("misc:disable_xdg_env_checks"); - static auto PNOCHECKGUIUTILS = CConfigValue<Hyprlang::INT>("misc:disable_hyprland_guiutils_check"); - static auto PNOWATCHDOG = CConfigValue<Hyprlang::INT>("misc:disable_watchdog_warning"); + static auto PNOCHECKXDG = CConfigValue<Config::INTEGER>("misc:disable_xdg_env_checks"); + static auto PNOCHECKGUIUTILS = CConfigValue<Config::INTEGER>("misc:disable_hyprland_guiutils_check"); + static auto PNOWATCHDOG = CConfigValue<Config::INTEGER>("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<Hyprlang::INT>("group:group_on_movetoworkspace"); + static auto PGROUPONMOVETOWORKSPACE = CConfigValue<Config::INTEGER>("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<Hyprlang::INT>("xwayland:force_zero_scaling"); + static auto PXWLFORCESCALEZERO = CConfigValue<Config::INTEGER>("xwayland:force_zero_scaling"); std::vector<PHLMONITOR> toArrange(m_monitors.begin(), m_monitors.end()); std::vector<PHLMONITOR> arranged; |
