summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2023-10-17 20:09:54 +0100
committerVaxry <vaxry@vaxry.net>2023-10-17 20:10:07 +0100
commita0b675ec9e57af8bc631fc8cc54d062b58669a9f (patch)
tree5225815cfb5a4872c8087874a594a3a09dd83490 /src
parent784f8a88fb59c9674648e275e78903ac15bbbf9f (diff)
binds: add ignoreMods flag
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp10
-rw-r--r--src/managers/KeybindManager.cpp3
-rw-r--r--src/managers/KeybindManager.hpp4
3 files changed, 12 insertions, 5 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 5ae341f8..2c3f6474 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -832,6 +832,7 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v
bool mouse = false;
bool nonConsuming = false;
bool transparent = false;
+ bool ignoreMods = false;
const auto BINDARGS = command.substr(4);
for (auto& arg : BINDARGS) {
@@ -847,6 +848,8 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v
nonConsuming = true;
} else if (arg == 't') {
transparent = true;
+ } else if (arg == 'i') {
+ ignoreMods = true;
} else {
parseError = "bind: invalid flag";
return;
@@ -904,12 +907,13 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v
if (KEY != "") {
if (isNumber(KEY) && std::stoi(KEY) > 9)
- g_pKeybindManager->addKeybind(SKeybind{"", std::stoi(KEY), MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap, release, repeat, mouse, nonConsuming, transparent});
+ g_pKeybindManager->addKeybind(
+ SKeybind{"", std::stoi(KEY), MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap, release, repeat, mouse, nonConsuming, transparent, ignoreMods});
else if (KEY.starts_with("code:") && isNumber(KEY.substr(5)))
g_pKeybindManager->addKeybind(
- SKeybind{"", std::stoi(KEY.substr(5)), MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap, release, repeat, mouse, nonConsuming, transparent});
+ SKeybind{"", std::stoi(KEY.substr(5)), MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap, release, repeat, mouse, nonConsuming, transparent, ignoreMods});
else
- g_pKeybindManager->addKeybind(SKeybind{KEY, -1, MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap, release, repeat, mouse, nonConsuming, transparent});
+ g_pKeybindManager->addKeybind(SKeybind{KEY, -1, MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap, release, repeat, mouse, nonConsuming, transparent, ignoreMods});
}
}
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index cd99c61f..7e0b7620 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -435,7 +435,8 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string&
const bool IGNORECONDITIONS =
SPECIALDISPATCHER && !pressed && SPECIALTRIGGERED; // ignore mods. Pass, global dispatchers should be released immediately once the key is released.
- if (!IGNORECONDITIONS && (modmask != k.modmask || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked) || k.submap != m_szCurrentSelectedSubmap || k.shadowed))
+ if (!IGNORECONDITIONS &&
+ ((modmask != k.modmask && !k.ignoreMods) || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked) || k.submap != m_szCurrentSelectedSubmap || k.shadowed))
continue;
if (!key.empty()) {
diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp
index 9c63249e..8a0b3b89 100644
--- a/src/managers/KeybindManager.hpp
+++ b/src/managers/KeybindManager.hpp
@@ -23,12 +23,14 @@ struct SKeybind {
bool mouse = false;
bool nonConsuming = false;
bool transparent = false;
+ bool ignoreMods = false;
// DO NOT INITIALIZE
bool shadowed = false;
};
-enum eFocusWindowMode {
+enum eFocusWindowMode
+{
MODE_CLASS_REGEX = 0,
MODE_TITLE_REGEX,
MODE_ADDRESS,