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.
This commit is contained in:
ItsOhen 2025-10-11 02:40:18 +02:00 committed by GitHub
parent 6a01c399a9
commit d599513d4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 102 additions and 26 deletions

View file

@ -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 {};
}