config/keybinds: add a submap universal keybind flag (#12100)

This commit is contained in:
Luke Barkess 2025-11-11 22:59:21 +00:00 committed by GitHub
parent ee2168c665
commit 308226a4fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 107 additions and 72 deletions

View file

@ -2539,52 +2539,45 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
// bind[fl]=SUPER,G,exec,dmenu_run <args>
// 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<std::string> 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 {};