From 308226a4fc2c9b63fa19894d5f85e79e05d75e03 Mon Sep 17 00:00:00 2001 From: Luke Barkess <57995669+Brumus14@users.noreply.github.com> Date: Tue, 11 Nov 2025 22:59:21 +0000 Subject: config/keybinds: add a submap universal keybind flag (#12100) --- src/config/ConfigManager.cpp | 83 ++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 45 deletions(-) (limited to 'src/config/ConfigManager.cpp') diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index d03ad83e..a3c60d2b 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2539,52 +2539,45 @@ std::optional CConfigManager::handleBind(const std::string& command // bind[fl]=SUPER,G,exec,dmenu_run // flags - bool locked = false; - bool release = false; - bool repeat = false; - bool mouse = false; - bool nonConsuming = false; - bool transparent = false; - bool ignoreMods = false; - bool multiKey = false; - bool longPress = false; - bool hasDescription = false; - bool dontInhibit = false; - bool click = false; - bool drag = false; - const auto BINDARGS = command.substr(4); + bool locked = false; + bool release = false; + bool repeat = false; + bool mouse = false; + bool nonConsuming = false; + bool transparent = false; + bool ignoreMods = false; + bool multiKey = false; + bool longPress = false; + bool hasDescription = false; + bool dontInhibit = false; + bool click = false; + bool drag = false; + bool submapUniversal = false; + const auto BINDARGS = command.substr(4); for (auto const& arg : BINDARGS) { - if (arg == 'l') { - locked = true; - } else if (arg == 'r') { - release = true; - } else if (arg == 'e') { - repeat = true; - } else if (arg == 'm') { - mouse = true; - } else if (arg == 'n') { - nonConsuming = true; - } else if (arg == 't') { - transparent = true; - } else if (arg == 'i') { - ignoreMods = true; - } else if (arg == 's') { - multiKey = true; - } else if (arg == 'o') { - longPress = true; - } else if (arg == 'd') { - hasDescription = true; - } else if (arg == 'p') { - dontInhibit = true; - } else if (arg == 'c') { - click = true; - release = true; - } else if (arg == 'g') { - drag = true; - release = true; - } else { - return "bind: invalid flag"; + switch (arg) { + case 'l': locked = true; break; + case 'r': release = true; break; + case 'e': repeat = true; break; + case 'm': mouse = true; break; + case 'n': nonConsuming = true; break; + case 't': transparent = true; break; + case 'i': ignoreMods = true; break; + case 's': multiKey = true; break; + case 'o': longPress = true; break; + case 'd': hasDescription = true; break; + case 'p': dontInhibit = true; break; + case 'c': + click = true; + release = true; + break; + case 'g': + drag = true; + release = true; + break; + case 'u': submapUniversal = true; break; + default: return "bind: invalid flag"; } } @@ -2657,7 +2650,7 @@ std::optional CConfigManager::handleBind(const std::string& command g_pKeybindManager->addKeybind(SKeybind{parsedKey.key, KEYSYMS, parsedKey.keycode, parsedKey.catchAll, MOD, MODS, HANDLER, COMMAND, locked, m_currentSubmap, DESCRIPTION, release, repeat, longPress, mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription, dontInhibit, - click, drag}); + click, drag, submapUniversal}); } return {}; -- cgit v1.2.3