keybinds: add bindp and noshortcutsinhibit (#7017)

This commit is contained in:
MightyPlaza 2024-07-24 12:10:36 +00:00 committed by GitHub
parent 99088eaed8
commit 72bce7efd5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 34 additions and 23 deletions

View file

@ -1983,6 +1983,7 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
bool ignoreMods = false; bool ignoreMods = false;
bool multiKey = false; bool multiKey = false;
bool hasDescription = false; bool hasDescription = false;
bool dontInhibit = false;
const auto BINDARGS = command.substr(4); const auto BINDARGS = command.substr(4);
for (auto& arg : BINDARGS) { for (auto& arg : BINDARGS) {
@ -2004,6 +2005,8 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
multiKey = true; multiKey = true;
} else if (arg == 'd') { } else if (arg == 'd') {
hasDescription = true; hasDescription = true;
} else if (arg == 'p') {
dontInhibit = true;
} else { } else {
return "bind: invalid flag"; 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."; 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, g_pKeybindManager->addKeybind(SKeybind{
release, repeat, mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription}); 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 {}; return {};

View file

@ -182,6 +182,7 @@ class CConfigManager {
{"nomaxsize", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noMaxSize; }}, {"nomaxsize", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noMaxSize; }},
{"norounding", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noRounding; }}, {"norounding", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noRounding; }},
{"noshadow", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShadow; }}, {"noshadow", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShadow; }},
{"noshortcutsinhibit", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShortcutsInhibit; }},
{"opaque", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.opaque; }}, {"opaque", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.opaque; }},
{"forcergbx", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.RGBX; }}, {"forcergbx", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.RGBX; }},
{"immediate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.tearing; }}, {"immediate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.tearing; }},

View file

@ -153,24 +153,25 @@ struct SWindowData {
CWindowOverridableVar<SAlphaValue> alphaInactive = SAlphaValue{1.f, false}; CWindowOverridableVar<SAlphaValue> alphaInactive = SAlphaValue{1.f, false};
CWindowOverridableVar<SAlphaValue> alphaFullscreen = SAlphaValue{1.f, false}; CWindowOverridableVar<SAlphaValue> alphaFullscreen = SAlphaValue{1.f, false};
CWindowOverridableVar<bool> allowsInput = false; CWindowOverridableVar<bool> allowsInput = false;
CWindowOverridableVar<bool> dimAround = false; CWindowOverridableVar<bool> dimAround = false;
CWindowOverridableVar<bool> decorate = true; CWindowOverridableVar<bool> decorate = true;
CWindowOverridableVar<bool> focusOnActivate = false; CWindowOverridableVar<bool> focusOnActivate = false;
CWindowOverridableVar<bool> keepAspectRatio = false; CWindowOverridableVar<bool> keepAspectRatio = false;
CWindowOverridableVar<bool> nearestNeighbor = false; CWindowOverridableVar<bool> nearestNeighbor = false;
CWindowOverridableVar<bool> noAnim = false; CWindowOverridableVar<bool> noAnim = false;
CWindowOverridableVar<bool> noBorder = false; CWindowOverridableVar<bool> noBorder = false;
CWindowOverridableVar<bool> noBlur = false; CWindowOverridableVar<bool> noBlur = false;
CWindowOverridableVar<bool> noDim = false; CWindowOverridableVar<bool> noDim = false;
CWindowOverridableVar<bool> noFocus = false; CWindowOverridableVar<bool> noFocus = false;
CWindowOverridableVar<bool> noMaxSize = false; CWindowOverridableVar<bool> noMaxSize = false;
CWindowOverridableVar<bool> noRounding = false; CWindowOverridableVar<bool> noRounding = false;
CWindowOverridableVar<bool> noShadow = false; CWindowOverridableVar<bool> noShadow = false;
CWindowOverridableVar<bool> opaque = false; CWindowOverridableVar<bool> noShortcutsInhibit = false;
CWindowOverridableVar<bool> RGBX = false; CWindowOverridableVar<bool> opaque = false;
CWindowOverridableVar<bool> tearing = false; CWindowOverridableVar<bool> RGBX = false;
CWindowOverridableVar<bool> xray = false; CWindowOverridableVar<bool> tearing = false;
CWindowOverridableVar<bool> xray = false;
CWindowOverridableVar<int> rounding; CWindowOverridableVar<int> rounding;
CWindowOverridableVar<int> borderSize; CWindowOverridableVar<int> borderSize;

View file

@ -607,10 +607,8 @@ bool CKeybindManager::handleKeybinds(const uint32_t modmask, const SPressedKeyWi
static auto PDISABLEINHIBIT = CConfigValue<Hyprlang::INT>("binds:disable_keybind_grabbing"); 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"); Debug::log(LOG, "Keybind handling is disabled due to an inhibitor");
return false;
}
for (auto& k : m_lKeybinds) { for (auto& k : m_lKeybinds) {
const bool SPECIALDISPATCHER = k.handler == "global" || k.handler == "pass" || k.handler == "sendshortcut" || k.handler == "mouse"; 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 = const bool IGNORECONDITIONS =
SPECIALDISPATCHER && !pressed && SPECIALTRIGGERED; // ignore mods. Pass, global dispatchers should be released immediately once the key is released. 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()) if (!k.locked && g_pSessionLockManager->isSessionLocked())
continue; continue;

View file

@ -34,6 +34,7 @@ struct SKeybind {
bool ignoreMods = false; bool ignoreMods = false;
bool multiKey = false; bool multiKey = false;
bool hasDescription = false; bool hasDescription = false;
bool dontInhibit = false;
// DO NOT INITIALIZE // DO NOT INITIALIZE
bool shadowed = false; bool shadowed = false;

View file

@ -73,6 +73,9 @@ bool CKeyboardShortcutsInhibitProtocol::isInhibited() {
if (!g_pCompositor->m_pLastFocus) if (!g_pCompositor->m_pLastFocus)
return false; return false;
if (g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus.lock())->m_sWindowData.noShortcutsInhibit.valueOrDefault())
return false;
for (auto& in : m_vInhibitors) { for (auto& in : m_vInhibitors) {
if (in->surface() != g_pCompositor->m_pLastFocus) if (in->surface() != g_pCompositor->m_pLastFocus)
continue; continue;