summaryrefslogtreecommitdiff
path: root/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
diff options
context:
space:
mode:
authorThedudeman <108754421+RockClapps@users.noreply.github.com>2026-03-02 07:51:56 -0500
committerGitHub <noreply@github.com>2026-03-02 12:51:56 +0000
commit743dffd6381a62e385123ee953ff97f6820f60ed (patch)
tree84b7d34a9f5970ebb2f874f99ea6036b2b4075c9 /src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
parent5c370c3333aa6648c014a550c8b64f7f90c3f777 (diff)
layout/scroll: fix configuredWidths not setting properly on new workspaces (#13476)
Diffstat (limited to 'src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp')
-rw-r--r--src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
index c7fe6078..2862ef4a 100644
--- a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
+++ b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
@@ -466,6 +466,21 @@ CScrollingAlgorithm::CScrollingAlgorithm() {
m_scrollingData = makeShared<SScrollingData>(this);
m_scrollingData->self = m_scrollingData;
+ // Helper to parse explicit_column_widths string
+ auto parseColumnWidths = [](const std::string& dir) -> std::vector<float> {
+ auto widthVec = std::vector<float>();
+
+ CConstVarList widths(dir, 0, ',');
+ for (auto& w : widths) {
+ try {
+ widthVec.emplace_back(std::clamp(std::stof(std::string{w}), MIN_COLUMN_WIDTH, MAX_COLUMN_WIDTH));
+ } catch (...) { Log::logger->log(Log::ERR, "scrolling: Failed to parse width {} as float", w); }
+ }
+ if (widthVec.empty())
+ widthVec = {0.333, 0.5, 0.667, 1.0}; // default
+ return widthVec;
+ };
+
// Helper to parse direction string
auto parseDirection = [](const std::string& dir) -> eScrollDirection {
if (dir == "left")
@@ -478,19 +493,11 @@ CScrollingAlgorithm::CScrollingAlgorithm() {
return SCROLL_DIR_RIGHT; // default
};
- m_configCallback = Event::bus()->m_events.config.reloaded.listen([this, parseDirection] {
+ m_configCallback = Event::bus()->m_events.config.reloaded.listen([this, parseColumnWidths, parseDirection] {
static const auto PCONFDIRECTION = CConfigValue<Hyprlang::STRING>("scrolling:direction");
m_config.configuredWidths.clear();
-
- CConstVarList widths(*PCONFWIDTHS, 0, ',');
- for (auto& w : widths) {
- try {
- m_config.configuredWidths.emplace_back(std::clamp(std::stof(std::string{w}), MIN_COLUMN_WIDTH, MAX_COLUMN_WIDTH));
- } catch (...) { Log::logger->log(Log::ERR, "scrolling: Failed to parse width {} as float", w); }
- }
- if (m_config.configuredWidths.empty())
- m_config.configuredWidths = {0.333, 0.5, 0.667, 1.0};
+ m_config.configuredWidths = parseColumnWidths(*PCONFWIDTHS);
// Update scroll direction
m_scrollingData->controller->setDirection(parseDirection(*PCONFDIRECTION));
@@ -523,7 +530,7 @@ CScrollingAlgorithm::CScrollingAlgorithm() {
});
// Initialize default widths and direction
- m_config.configuredWidths = {0.333, 0.5, 0.667, 1.0};
+ m_config.configuredWidths = parseColumnWidths(*PCONFWIDTHS);
m_scrollingData->controller->setDirection(parseDirection(*PCONFDIRECTION));
}