From d599513d4a72d66ac62ffdedc41d6653fa81b39e Mon Sep 17 00:00:00 2001 From: ItsOhen Date: Sat, 11 Oct 2025 02:40:18 +0200 Subject: config: add automatic closing to submaps (#11760) * Allow submaps to auto reset to parent. * Really should be a stack instead. If hyprlang would allow for { } i would be so happy. * Fixed: Somewhat better way to do it.. Lets you define what submap you want to go to instead. * squash! Fixed: Somewhat better way to do it.. * God i hate cf.. * Force clang-format on the whole thing.. * Removed {}. * Added tests Tests and reset fix. --- src/config/ConfigManager.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/config/ConfigManager.cpp') diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 936ec383..47ac4730 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2630,7 +2630,7 @@ std::optional CConfigManager::handleBind(const std::string& command if ((!KEY.empty()) || multiKey) { SParsedKey parsedKey = parseKey(KEY); - if (parsedKey.catchAll && m_currentSubmap.empty()) { + if (parsedKey.catchAll && m_currentSubmap.name.empty()) { Debug::log(ERR, "Catchall not allowed outside of submap!"); return "Invalid catchall, catchall keybinds are only allowed in submaps."; } @@ -3011,12 +3011,10 @@ std::optional CConfigManager::handleWorkspaceRules(const std::strin return {}; } -std::optional CConfigManager::handleSubmap(const std::string& command, const std::string& submap) { - if (submap == "reset") - m_currentSubmap = ""; - else - m_currentSubmap = submap; - +std::optional CConfigManager::handleSubmap(const std::string&, const std::string& submap) { + const auto SUBMAP = CConstVarList(submap); + m_currentSubmap.name = (SUBMAP[0] == "reset") ? "" : SUBMAP[0]; + m_currentSubmap.reset = SUBMAP[1]; return {}; } -- cgit v1.2.3