summaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-03-20 13:52:37 -0400
committerGitHub <noreply@github.com>2026-03-20 17:52:37 +0000
commit8726a7363eb9213235e6e23657668e0daac39a5b (patch)
tree42eeb40f6f81a9ccec1455f308e56173e9dcce4b /src/layout
parentb940b0d2c197841b0f648598ee782dbaf9e0a89b (diff)
config: cleanup the entire config infrastructure (#13785)
Massively refactors the config infrastructure, sorely needed and will be req'd for the lua stuff
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/LayoutManager.cpp8
-rw-r--r--src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp3
-rw-r--r--src/layout/algorithm/tiled/master/MasterAlgorithm.cpp10
-rw-r--r--src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp9
-rw-r--r--src/layout/space/Space.cpp14
-rw-r--r--src/layout/supplementary/WorkspaceAlgoMatcher.cpp6
-rw-r--r--src/layout/target/WindowTarget.cpp11
7 files changed, 35 insertions, 26 deletions
diff --git a/src/layout/LayoutManager.cpp b/src/layout/LayoutManager.cpp
index d5103fb5..1c738426 100644
--- a/src/layout/LayoutManager.cpp
+++ b/src/layout/LayoutManager.cpp
@@ -3,7 +3,7 @@
#include "space/Space.hpp"
#include "target/Target.hpp"
-#include "../config/ConfigManager.hpp"
+#include "../helpers/Monitor.hpp"
#include "../Compositor.hpp"
#include "../desktop/state/FocusState.hpp"
#include "../desktop/view/Group.hpp"
@@ -194,7 +194,7 @@ void CLayoutManager::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, SP<I
static auto PGAPSIN = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_in");
static auto PGAPSOUT = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
- const auto GAPSNONE = CCssGapData{0, 0, 0, 0};
+ const auto GAPSNONE = Config::CCssGapData{0, 0, 0, 0};
const SnapFn SNAP = (MODE == MBIND_MOVE) ? snapMove : snapResize;
int snaps = 0;
@@ -212,7 +212,7 @@ void CLayoutManager::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, SP<I
const auto WSID = DRAGGINGWINDOW->workspaceID();
const bool HASFULLSCREEN = DRAGGINGWINDOW->m_workspace && DRAGGINGWINDOW->m_workspace->m_hasFullscreenWindow;
- const auto* GAPSIN = *SNAPRESPECTGAPS ? sc<CCssGapData*>(PGAPSIN.ptr()->getData()) : &GAPSNONE;
+ const auto* GAPSIN = *SNAPRESPECTGAPS ? sc<Config::CCssGapData*>(PGAPSIN.ptr()->getData()) : &GAPSNONE;
const double GAPSX = GAPSIN->m_left + GAPSIN->m_right;
const double GAPSY = GAPSIN->m_top + GAPSIN->m_bottom;
@@ -275,7 +275,7 @@ void CLayoutManager::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, SP<I
const auto* EXTENTDIFF = *SNAPBORDEROVERLAP ? &EXTENTS : &EXTENTNONE;
const auto MON = DRAGGINGWINDOW->m_monitor.lock();
- const auto* GAPSOUT = *SNAPRESPECTGAPS ? sc<CCssGapData*>(PGAPSOUT.ptr()->getData()) : &GAPSNONE;
+ const auto* GAPSOUT = *SNAPRESPECTGAPS ? sc<Config::CCssGapData*>(PGAPSOUT.ptr()->getData()) : &GAPSNONE;
const auto WORK_AREA = Desktop::CReservedArea{GAPSOUT->m_top, GAPSOUT->m_right, GAPSOUT->m_bottom, GAPSOUT->m_left}.apply(MON->logicalBoxMinusReserved());
SRange monX = {WORK_AREA.x, WORK_AREA.x + WORK_AREA.w};
diff --git a/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp b/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp
index d7eaa61f..78ed9480 100644
--- a/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp
+++ b/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp
@@ -11,10 +11,13 @@
#include "../../../../Compositor.hpp"
#include <hyprutils/utils/ScopeGuard.hpp>
+#include <hyprutils/string/VarList2.hpp>
using namespace Layout;
using namespace Layout::Tiled;
+using namespace Hyprutils::String;
+
struct Layout::Tiled::SDwindleNodeData {
WP<SDwindleNodeData> pParent;
bool isNode = false;
diff --git a/src/layout/algorithm/tiled/master/MasterAlgorithm.cpp b/src/layout/algorithm/tiled/master/MasterAlgorithm.cpp
index 7696f66f..7017deb1 100644
--- a/src/layout/algorithm/tiled/master/MasterAlgorithm.cpp
+++ b/src/layout/algorithm/tiled/master/MasterAlgorithm.cpp
@@ -5,16 +5,18 @@
#include "../../../target/WindowTarget.hpp"
#include "../../../../config/ConfigValue.hpp"
-#include "../../../../config/ConfigManager.hpp"
+#include "../../../../config/shared/workspace/WorkspaceRuleManager.hpp"
#include "../../../../desktop/state/FocusState.hpp"
#include "../../../../helpers/Monitor.hpp"
#include "../../../../Compositor.hpp"
#include "../../../../render/Renderer.hpp"
#include <hyprutils/utils/ScopeGuard.hpp>
+#include <hyprutils/string/VarList2.hpp>
using namespace Layout;
using namespace Layout::Tiled;
+using namespace Hyprutils::String;
struct Layout::Tiled::SMasterNodeData {
bool isMaster = false;
@@ -845,10 +847,10 @@ void CMasterAlgorithm::buildOrientationCycleVectorFromEOperation(std::vector<eOr
eOrientation CMasterAlgorithm::defaultOrientation() {
static auto PORIENT = CConfigValue<std::string>("master:orientation");
- const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(m_parent->space()->workspace());
+ const auto WORKSPACERULE = Config::workspaceRuleMgr()->getWorkspaceRuleFor(m_parent->space()->workspace());
std::string orientationString;
- if (WORKSPACERULE.layoutopts.contains("orientation"))
- orientationString = WORKSPACERULE.layoutopts.at("orientation");
+ if (WORKSPACERULE && WORKSPACERULE->m_layoutopts.contains("orientation"))
+ orientationString = WORKSPACERULE->m_layoutopts.at("orientation");
else
orientationString = *PORIENT;
diff --git a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
index 8a5b2d59..addd371d 100644
--- a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
+++ b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
@@ -8,12 +8,13 @@
#include "../../../../Compositor.hpp"
#include "../../../../desktop/state/FocusState.hpp"
#include "../../../../config/ConfigValue.hpp"
-#include "../../../../config/ConfigManager.hpp"
+#include "../../../../config/shared/workspace/WorkspaceRuleManager.hpp"
#include "../../../../render/Renderer.hpp"
#include "../../../../managers/input/InputManager.hpp"
#include "../../../../event/EventBus.hpp"
#include <hyprutils/string/VarList2.hpp>
+#include <hyprutils/string/VarList.hpp>
#include <hyprutils/string/ConstVarList.hpp>
#include <hyprutils/utils/ScopeGuard.hpp>
@@ -1488,10 +1489,10 @@ SP<SScrollingTargetData> CScrollingAlgorithm::dataFor(SP<ITarget> t) {
}
eScrollDirection CScrollingAlgorithm::getDynamicDirection() {
- const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(m_parent->space()->workspace());
+ const auto WORKSPACERULE = Config::workspaceRuleMgr()->getWorkspaceRuleFor(m_parent->space()->workspace());
std::string directionString;
- if (WORKSPACERULE.layoutopts.contains("direction"))
- directionString = WORKSPACERULE.layoutopts.at("direction");
+ if (WORKSPACERULE && WORKSPACERULE->m_layoutopts.contains("direction"))
+ directionString = WORKSPACERULE->m_layoutopts.at("direction");
static const auto PCONFDIRECTION = CConfigValue<Hyprlang::STRING>("scrolling:direction");
std::string configDirection = *PCONFDIRECTION;
diff --git a/src/layout/space/Space.cpp b/src/layout/space/Space.cpp
index a02ba517..db014472 100644
--- a/src/layout/space/Space.cpp
+++ b/src/layout/space/Space.cpp
@@ -5,8 +5,10 @@
#include "../../debug/log/Logger.hpp"
#include "../../desktop/Workspace.hpp"
-#include "../../config/ConfigManager.hpp"
+#include "../../config/shared/workspace/WorkspaceRuleManager.hpp"
+#include "../../config/ConfigValue.hpp"
#include "../../event/EventBus.hpp"
+#include "../../helpers/Monitor.hpp"
using namespace Layout;
@@ -78,19 +80,19 @@ void CSpace::recheckWorkArea() {
return;
}
- const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(m_parent.lock());
+ const auto WORKSPACERULE = Config::workspaceRuleMgr()->getWorkspaceRuleFor(m_parent.lock()).value_or(Config::CWorkspaceRule{});
auto workArea = m_parent->m_monitor->logicalBoxMinusReserved();
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
static auto PFLOATGAPSDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:float_gaps");
- auto* const PGAPSOUT = sc<CCssGapData*>((PGAPSOUTDATA.ptr())->getData());
- auto* PFLOATGAPS = sc<CCssGapData*>(PFLOATGAPSDATA.ptr()->getData());
+ auto* const PGAPSOUT = sc<Config::CCssGapData*>((PGAPSOUTDATA.ptr())->getData());
+ auto* PFLOATGAPS = sc<Config::CCssGapData*>(PFLOATGAPSDATA.ptr()->getData());
if (PFLOATGAPS->m_bottom < 0 || PFLOATGAPS->m_left < 0 || PFLOATGAPS->m_right < 0 || PFLOATGAPS->m_top < 0)
PFLOATGAPS = PGAPSOUT;
- auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);
- auto gapsFloat = WORKSPACERULE.gapsOut.value_or(*PFLOATGAPS);
+ auto gapsOut = WORKSPACERULE.m_gapsOut.value_or(*PGAPSOUT);
+ auto gapsFloat = WORKSPACERULE.m_gapsOut.value_or(*PFLOATGAPS);
Desktop::CReservedArea reservedGaps{gapsOut.m_top, gapsOut.m_right, gapsOut.m_bottom, gapsOut.m_left};
Desktop::CReservedArea reservedFloatGaps{gapsFloat.m_top, gapsFloat.m_right, gapsFloat.m_bottom, gapsFloat.m_left};
diff --git a/src/layout/supplementary/WorkspaceAlgoMatcher.cpp b/src/layout/supplementary/WorkspaceAlgoMatcher.cpp
index b476c3a0..98cdb773 100644
--- a/src/layout/supplementary/WorkspaceAlgoMatcher.cpp
+++ b/src/layout/supplementary/WorkspaceAlgoMatcher.cpp
@@ -1,7 +1,7 @@
#include "WorkspaceAlgoMatcher.hpp"
#include "../../config/ConfigValue.hpp"
-#include "../../config/ConfigManager.hpp"
+#include "../../config/shared/workspace/WorkspaceRuleManager.hpp"
#include "../algorithm/Algorithm.hpp"
#include "../space/Space.hpp"
@@ -103,8 +103,8 @@ UP<IFloatingAlgorithm> CWorkspaceAlgoMatcher::algoForNameFloat(const std::string
std::string CWorkspaceAlgoMatcher::tiledAlgoForWorkspace(const PHLWORKSPACE& w) {
static auto PLAYOUT = CConfigValue<Hyprlang::STRING>("general:layout");
- auto rule = g_pConfigManager->getWorkspaceRuleFor(w);
- return rule.layout.value_or(*PLAYOUT);
+ auto rule = Config::workspaceRuleMgr()->getWorkspaceRuleFor(w);
+ return rule && rule->m_layout.has_value() ? rule->m_layout.value() : *PLAYOUT;
}
SP<CAlgorithm> CWorkspaceAlgoMatcher::createAlgorithmForWorkspace(PHLWORKSPACE w) {
diff --git a/src/layout/target/WindowTarget.cpp b/src/layout/target/WindowTarget.cpp
index bd94a8c9..3bc36c2a 100644
--- a/src/layout/target/WindowTarget.cpp
+++ b/src/layout/target/WindowTarget.cpp
@@ -4,11 +4,12 @@
#include "../algorithm/Algorithm.hpp"
#include "../../protocols/core/Compositor.hpp"
-#include "../../config/ConfigManager.hpp"
+#include "../../config/shared/workspace/WorkspaceRuleManager.hpp"
#include "../../helpers/Monitor.hpp"
#include "../../xwayland/XSurface.hpp"
#include "../../Compositor.hpp"
#include "../../render/Renderer.hpp"
+#include "../../desktop/state/FloatState.hpp"
#include <hyprutils/utils/ScopeGuard.hpp>
@@ -71,7 +72,7 @@ void CWindowTarget::updatePos() {
// get specific gaps and rules for this workspace,
// if user specified them in config
- const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE);
+ const auto WORKSPACERULE = Config::workspaceRuleMgr()->getWorkspaceRuleFor(PWORKSPACE);
if (!validMapped(m_window)) {
if (m_window)
@@ -107,8 +108,8 @@ void CWindowTarget::updatePos() {
const bool DISPLAYINVERSERIGHT = STICKS(m_box.logicalBox.x + m_box.logicalBox.w, MONITOR_WORKAREA.x);
static auto PGAPSINDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_in");
- auto* const PGAPSIN = sc<CCssGapData*>((PGAPSINDATA.ptr())->getData());
- auto gapsIn = WORKSPACERULE.gapsIn.value_or(*PGAPSIN);
+ auto* const PGAPSIN = sc<Config::CCssGapData*>((PGAPSINDATA.ptr())->getData());
+ auto gapsIn = (WORKSPACERULE && WORKSPACERULE->m_gapsIn.has_value()) ? WORKSPACERULE->m_gapsIn.value() : *PGAPSIN;
const static auto REQUESTEDRATIO = CConfigValue<Hyprlang::VEC2>("layout:single_window_aspect_ratio");
const static auto REQUESTEDRATIOTOLERANCE = CConfigValue<Hyprlang::FLOAT>("layout:single_window_aspect_ratio_tolerance");
@@ -264,7 +265,7 @@ std::expected<SGeometryRequested, eGeometryFailure> CWindowTarget::desiredGeomet
DESIRED_GEOM.y = xy.y;
}
- const auto STOREDSIZE = m_window->m_ruleApplicator->persistentSize().valueOrDefault() ? g_pConfigManager->getStoredFloatingSize(m_window.lock()) : std::nullopt;
+ const auto STOREDSIZE = m_window->m_ruleApplicator->persistentSize().valueOrDefault() ? Desktop::floatState()->get(m_window.lock()) : std::nullopt;
if (STOREDSIZE)
requested.size = clampSizeForDesired(*STOREDSIZE);