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. --- .../tiled/scrolling/ScrollingAlgorithm.cpp | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp') diff --git a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp index 83ab0974..3322d466 100644 --- a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp +++ b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp @@ -378,7 +378,7 @@ void SScrollingData::centerCol(SP c) { if (!c) return; - static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); + static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); const auto USABLE = algorithm->usableArea(); int64_t colIdx = idx(c); @@ -390,7 +390,7 @@ void SScrollingData::fitCol(SP c) { if (!c) return; - static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); + static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); const auto USABLE = algorithm->usableArea(); int64_t colIdx = idx(c); @@ -402,7 +402,7 @@ void SScrollingData::centerOrFitCol(SP c) { if (!c) return; - static const auto PFITMETHOD = CConfigValue("scrolling:focus_fit_method"); + static const auto PFITMETHOD = CConfigValue("scrolling:focus_fit_method"); if (*PFITMETHOD == 1) fitCol(c); @@ -411,7 +411,7 @@ void SScrollingData::centerOrFitCol(SP c) { } SP SScrollingData::atCenter() { - static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); + static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); const auto USABLE = algorithm->usableArea(); size_t centerIdx = controller->getStripAtCenter(USABLE, *PFSONONE); @@ -427,7 +427,7 @@ void SScrollingData::recalculate(bool forceInstant) { algorithm->m_parent->space()->workspace()->m_hasFullscreenWindow) return; - static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); + static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); const CBox USABLE = algorithm->usableArea(); const auto WORKAREA = algorithm->m_parent->space()->workArea(); @@ -451,14 +451,14 @@ void SScrollingData::recalculate(bool forceInstant) { } double SScrollingData::maxWidth() { - static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); + static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); const auto USABLE = algorithm->usableArea(); return controller->calculateMaxExtent(USABLE, *PFSONONE); } bool SScrollingData::visible(SP c, bool full) { - static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); + static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); const auto USABLE = algorithm->usableArea(); int64_t colIdx = idx(c); @@ -469,8 +469,8 @@ bool SScrollingData::visible(SP c, bool full) { } CScrollingAlgorithm::CScrollingAlgorithm() { - static const auto PCONFWIDTHS = CConfigValue("scrolling:explicit_column_widths"); - static const auto PCONFDIRECTION = CConfigValue("scrolling:direction"); + static const auto PCONFWIDTHS = CConfigValue("scrolling:explicit_column_widths"); + static const auto PCONFDIRECTION = CConfigValue("scrolling:direction"); m_scrollingData = makeShared(this); m_scrollingData->self = m_scrollingData; @@ -503,7 +503,7 @@ CScrollingAlgorithm::CScrollingAlgorithm() { }; m_configCallback = Event::bus()->m_events.config.reloaded.listen([this, parseColumnWidths, parseDirection] { - static const auto PCONFDIRECTION = CConfigValue("scrolling:direction"); + static const auto PCONFDIRECTION = CConfigValue("scrolling:direction"); m_config.configuredWidths.clear(); m_config.configuredWidths = parseColumnWidths(*PCONFWIDTHS); @@ -513,7 +513,7 @@ CScrollingAlgorithm::CScrollingAlgorithm() { }); m_mouseButtonCallback = Event::bus()->m_events.input.mouse.button.listen([this](IPointer::SButtonEvent e, Event::SCallbackInfo&) { - static const auto PFOLLOW_FOCUS = CConfigValue("scrolling:follow_focus"); + static const auto PFOLLOW_FOCUS = CConfigValue("scrolling:follow_focus"); if (*PFOLLOW_FOCUS && e.state == WL_POINTER_BUTTON_STATE_RELEASED && Desktop::focusState()->window()) focusOnInput(Desktop::focusState()->window()->layoutTarget(), INPUT_MODE_CLICK); @@ -523,7 +523,7 @@ CScrollingAlgorithm::CScrollingAlgorithm() { if (!pWindow) return; - static const auto PFOLLOW_FOCUS = CConfigValue("scrolling:follow_focus"); + static const auto PFOLLOW_FOCUS = CConfigValue("scrolling:follow_focus"); if (!*PFOLLOW_FOCUS && !Desktop::isHardInputFocusReason(reason)) return; @@ -549,7 +549,7 @@ CScrollingAlgorithm::~CScrollingAlgorithm() { } void CScrollingAlgorithm::focusOnInput(SP target, eInputMode input) { - static const auto PFOLLOW_FOCUS_MIN_PERC = CConfigValue("scrolling:follow_min_visible"); + static const auto PFOLLOW_FOCUS_MIN_PERC = CConfigValue("scrolling:follow_min_visible"); if (!target || target->space() != m_parent->space()) return; @@ -579,7 +579,7 @@ void CScrollingAlgorithm::focusOnInput(SP target, eInputMode input) { if (m_scrollingData->visible(TARGETDATA->column.lock(), true) && input != INPUT_MODE_KB) return; - static const auto PFITMETHOD = CConfigValue("scrolling:focus_fit_method"); + static const auto PFITMETHOD = CConfigValue("scrolling:focus_fit_method"); if (*PFITMETHOD == 1) m_scrollingData->fitCol(TARGETDATA->column.lock()); else @@ -671,7 +671,7 @@ void CScrollingAlgorithm::resizeTarget(const Vector2D& delta, SP target if (!DATA->column || !DATA->column->scrollingData) return; - static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); + static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); const auto ADJUSTED_DELTA = m_scrollingData->controller->isPrimaryHorizontal() ? delta : Vector2D{delta.y, delta.x}; const auto USABLE = usableArea(); @@ -859,7 +859,7 @@ void CScrollingAlgorithm::moveTargetInDirection(SP t, Math::eDirection } void CScrollingAlgorithm::moveTargetTo(SP t, Math::eDirection dir, bool silent) { - static auto PMONITORFALLBACK = CConfigValue("binds:window_direction_monitor_fallback"); + static auto PMONITORFALLBACK = CConfigValue("binds:window_direction_monitor_fallback"); const auto DATA = dataFor(t); @@ -986,7 +986,7 @@ void CScrollingAlgorithm::moveTargetTo(SP t, Math::eDirection dir, bool std::expected CScrollingAlgorithm::layoutMsg(const std::string_view& sv) { auto centerOrFit = [this](const SP COL) -> void { - static const auto PFITMETHOD = CConfigValue("scrolling:focus_fit_method"); + static const auto PFITMETHOD = CConfigValue("scrolling:focus_fit_method"); if (*PFITMETHOD == 1) m_scrollingData->fitCol(COL); else @@ -1267,8 +1267,8 @@ std::expected CScrollingAlgorithm::layoutMsg(const std::strin } } else if (ARGS[0] == "focus") { const auto TDATA = dataFor(Desktop::focusState()->window() ? Desktop::focusState()->window()->layoutTarget() : nullptr); - static const auto PNOFALLBACK = CConfigValue("general:no_focus_fallback"); - static const auto PCONFWRAPFOCUS = CConfigValue("scrolling:wrap_focus"); + static const auto PNOFALLBACK = CConfigValue("general:no_focus_fallback"); + static const auto PCONFWRAPFOCUS = CConfigValue("scrolling:wrap_focus"); if (!TDATA || ARGS[1].empty()) return std::unexpected("no window to focus"); @@ -1429,7 +1429,7 @@ std::expected CScrollingAlgorithm::layoutMsg(const std::strin m_scrollingData->recalculate(); } else if (ARGS[0] == "swapcol") { - static const auto PCONFWRAPSWAPCOL = CConfigValue("scrolling:wrap_swapcol"); + static const auto PCONFWRAPSWAPCOL = CConfigValue("scrolling:wrap_swapcol"); if (ARGS.size() < 2) return std::unexpected("not enough args"); @@ -1561,7 +1561,7 @@ eScrollDirection CScrollingAlgorithm::getDynamicDirection() { if (WORKSPACERULE && WORKSPACERULE->m_layoutopts.contains("direction")) directionString = WORKSPACERULE->m_layoutopts.at("direction"); - static const auto PCONFDIRECTION = CConfigValue("scrolling:direction"); + static const auto PCONFDIRECTION = CConfigValue("scrolling:direction"); std::string configDirection = *PCONFDIRECTION; // Workspace rule overrides global config @@ -1600,6 +1600,6 @@ CBox CScrollingAlgorithm::usableArea() { } float CScrollingAlgorithm::defaultColumnWidth() { - static const auto PCOLWIDTH = CConfigValue("scrolling:column_width"); + static const auto PCOLWIDTH = CConfigValue("scrolling:column_width"); return std::clamp(*PCOLWIDTH, MIN_COLUMN_WIDTH, MAX_COLUMN_WIDTH); } -- cgit v1.2.3