summaryrefslogtreecommitdiff
path: root/src/config/ConfigManager.cpp
diff options
context:
space:
mode:
authorItsOhen <TNordfeldt@gmail.com>2025-10-11 02:40:18 +0200
committerGitHub <noreply@github.com>2025-10-11 02:40:18 +0200
commitd599513d4a72d66ac62ffdedc41d6653fa81b39e (patch)
tree9ce093a84421330da38f015d40c94941b43e6a04 /src/config/ConfigManager.cpp
parent6a01c399a971a57854fb4a99ce246534139beda4 (diff)
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.
Diffstat (limited to 'src/config/ConfigManager.cpp')
-rw-r--r--src/config/ConfigManager.cpp12
1 files changed, 5 insertions, 7 deletions
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<std::string> 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<std::string> CConfigManager::handleWorkspaceRules(const std::strin
return {};
}
-std::optional<std::string> CConfigManager::handleSubmap(const std::string& command, const std::string& submap) {
- if (submap == "reset")
- m_currentSubmap = "";
- else
- m_currentSubmap = submap;
-
+std::optional<std::string> 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 {};
}