aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMightyPlaza <[email protected]>2024-07-24 12:10:36 +0000
committerGitHub <[email protected]>2024-07-24 14:10:36 +0200
commit72bce7efd5b302412f13485af27985965ddf830f (patch)
treed1236a7bfd80dc07d9f7bb49f48957c11b987463
parent99088eaed806d9268967baf09bc09cdb987c5357 (diff)
downloadHyprland-72bce7efd5b302412f13485af27985965ddf830f.tar.gz
Hyprland-72bce7efd5b302412f13485af27985965ddf830f.zip
keybinds: add bindp and noshortcutsinhibit (#7017)
-rw-r--r--src/config/ConfigManager.cpp8
-rw-r--r--src/config/ConfigManager.hpp1
-rw-r--r--src/desktop/Window.hpp37
-rw-r--r--src/managers/KeybindManager.cpp7
-rw-r--r--src/managers/KeybindManager.hpp1
-rw-r--r--src/protocols/ShortcutsInhibit.cpp3
6 files changed, 34 insertions, 23 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 6928a802..5a8f2bd2 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -1983,6 +1983,7 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
bool ignoreMods = false;
bool multiKey = false;
bool hasDescription = false;
+ bool dontInhibit = false;
const auto BINDARGS = command.substr(4);
for (auto& arg : BINDARGS) {
@@ -2004,6 +2005,8 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
multiKey = true;
} else if (arg == 'd') {
hasDescription = true;
+ } else if (arg == 'p') {
+ dontInhibit = true;
} else {
return "bind: invalid flag";
}
@@ -2072,8 +2075,9 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
return "Invalid catchall, catchall keybinds are only allowed in submaps.";
}
- g_pKeybindManager->addKeybind(SKeybind{parsedKey.key, KEYSYMS, parsedKey.keycode, parsedKey.catchAll, MOD, MODS, HANDLER, COMMAND, locked, m_szCurrentSubmap, DESCRIPTION,
- release, repeat, mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription});
+ g_pKeybindManager->addKeybind(SKeybind{
+ parsedKey.key, KEYSYMS, parsedKey.keycode, parsedKey.catchAll, MOD, MODS, HANDLER, COMMAND, locked, m_szCurrentSubmap, DESCRIPTION, release,
+ repeat, mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription, dontInhibit});
}
return {};
diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp
index df7c202b..b4a49b7a 100644
--- a/src/config/ConfigManager.hpp
+++ b/src/config/ConfigManager.hpp
@@ -182,6 +182,7 @@ class CConfigManager {
{"nomaxsize", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noMaxSize; }},
{"norounding", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noRounding; }},
{"noshadow", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShadow; }},
+ {"noshortcutsinhibit", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShortcutsInhibit; }},
{"opaque", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.opaque; }},
{"forcergbx", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.RGBX; }},
{"immediate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.tearing; }},
diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp
index 60189fac..108b804c 100644
--- a/src/desktop/Window.hpp
+++ b/src/desktop/Window.hpp
@@ -153,24 +153,25 @@ struct SWindowData {
CWindowOverridableVar<SAlphaValue> alphaInactive = SAlphaValue{1.f, false};
CWindowOverridableVar<SAlphaValue> alphaFullscreen = SAlphaValue{1.f, false};
- CWindowOverridableVar<bool> allowsInput = false;
- CWindowOverridableVar<bool> dimAround = false;
- CWindowOverridableVar<bool> decorate = true;
- CWindowOverridableVar<bool> focusOnActivate = false;
- CWindowOverridableVar<bool> keepAspectRatio = false;
- CWindowOverridableVar<bool> nearestNeighbor = false;
- CWindowOverridableVar<bool> noAnim = false;
- CWindowOverridableVar<bool> noBorder = false;
- CWindowOverridableVar<bool> noBlur = false;
- CWindowOverridableVar<bool> noDim = false;
- CWindowOverridableVar<bool> noFocus = false;
- CWindowOverridableVar<bool> noMaxSize = false;
- CWindowOverridableVar<bool> noRounding = false;
- CWindowOverridableVar<bool> noShadow = false;
- CWindowOverridableVar<bool> opaque = false;
- CWindowOverridableVar<bool> RGBX = false;
- CWindowOverridableVar<bool> tearing = false;
- CWindowOverridableVar<bool> xray = false;
+ CWindowOverridableVar<bool> allowsInput = false;
+ CWindowOverridableVar<bool> dimAround = false;
+ CWindowOverridableVar<bool> decorate = true;
+ CWindowOverridableVar<bool> focusOnActivate = false;
+ CWindowOverridableVar<bool> keepAspectRatio = false;
+ CWindowOverridableVar<bool> nearestNeighbor = false;
+ CWindowOverridableVar<bool> noAnim = false;
+ CWindowOverridableVar<bool> noBorder = false;
+ CWindowOverridableVar<bool> noBlur = false;
+ CWindowOverridableVar<bool> noDim = false;
+ CWindowOverridableVar<bool> noFocus = false;
+ CWindowOverridableVar<bool> noMaxSize = false;
+ CWindowOverridableVar<bool> noRounding = false;
+ CWindowOverridableVar<bool> noShadow = false;
+ CWindowOverridableVar<bool> noShortcutsInhibit = false;
+ CWindowOverridableVar<bool> opaque = false;
+ CWindowOverridableVar<bool> RGBX = false;
+ CWindowOverridableVar<bool> tearing = false;
+ CWindowOverridableVar<bool> xray = false;
CWindowOverridableVar<int> rounding;
CWindowOverridableVar<int> borderSize;
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index e9dfd1ae..185426dd 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -607,10 +607,8 @@ bool CKeybindManager::handleKeybinds(const uint32_t modmask, const SPressedKeyWi
static auto PDISABLEINHIBIT = CConfigValue<Hyprlang::INT>("binds:disable_keybind_grabbing");
- if (!*PDISABLEINHIBIT && PROTO::shortcutsInhibit->isInhibited()) {
+ if (!*PDISABLEINHIBIT && PROTO::shortcutsInhibit->isInhibited())
Debug::log(LOG, "Keybind handling is disabled due to an inhibitor");
- return false;
- }
for (auto& k : m_lKeybinds) {
const bool SPECIALDISPATCHER = k.handler == "global" || k.handler == "pass" || k.handler == "sendshortcut" || k.handler == "mouse";
@@ -619,6 +617,9 @@ bool CKeybindManager::handleKeybinds(const uint32_t modmask, const SPressedKeyWi
const bool IGNORECONDITIONS =
SPECIALDISPATCHER && !pressed && SPECIALTRIGGERED; // ignore mods. Pass, global dispatchers should be released immediately once the key is released.
+ if (!k.dontInhibit && !*PDISABLEINHIBIT && PROTO::shortcutsInhibit->isInhibited())
+ continue;
+
if (!k.locked && g_pSessionLockManager->isSessionLocked())
continue;
diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp
index 284280cd..e3ba2f2d 100644
--- a/src/managers/KeybindManager.hpp
+++ b/src/managers/KeybindManager.hpp
@@ -34,6 +34,7 @@ struct SKeybind {
bool ignoreMods = false;
bool multiKey = false;
bool hasDescription = false;
+ bool dontInhibit = false;
// DO NOT INITIALIZE
bool shadowed = false;
diff --git a/src/protocols/ShortcutsInhibit.cpp b/src/protocols/ShortcutsInhibit.cpp
index 211a7a01..226fccb6 100644
--- a/src/protocols/ShortcutsInhibit.cpp
+++ b/src/protocols/ShortcutsInhibit.cpp
@@ -73,6 +73,9 @@ bool CKeyboardShortcutsInhibitProtocol::isInhibited() {
if (!g_pCompositor->m_pLastFocus)
return false;
+ if (g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus.lock())->m_sWindowData.noShortcutsInhibit.valueOrDefault())
+ return false;
+
for (auto& in : m_vInhibitors) {
if (in->surface() != g_pCompositor->m_pLastFocus)
continue;