diff options
| author | Tobias Zimmermann <cu3po42@gmail.com> | 2024-03-03 01:17:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-03 00:17:02 +0000 |
| commit | 964f1a438df5114fd9d771f24015e95b8061e503 (patch) | |
| tree | da67dfeecbdb4ee04296b45278fcc725f43166bf /src/debug/HyprCtl.cpp | |
| parent | 508262b7db6e8e88573a4069c88b4fb88ccff1d5 (diff) | |
keybinds: Add the 'catchall' keyword that matches all keys (#4930)
* Add the 'catchall' keyword that matches all keys
This keyword can be used to define arbitrary keybinds. The only special
behavior that it exhibits is that it matches every key, including
modifier keys. Any flags still apply normally.
This commit also fixes an issue that keys bound via the code:KEYCODE
format were not unbound correctly.
* Disallow catchall keybinds outside of submaps
A catchall keybind outside a submap would prevent essentially all key
events from going through to applications and would be difficult to
remove again.
Diffstat (limited to 'src/debug/HyprCtl.cpp')
| -rw-r--r-- | src/debug/HyprCtl.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 962496f7..a65533d2 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -718,8 +718,8 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) { if (kb.nonConsuming) ret += "n"; - ret += std::format("\n\tmodmask: {}\n\tsubmap: {}\n\tkey: {}\n\tkeycode: {}\n\tdispatcher: {}\n\targ: {}\n\n", kb.modmask, kb.submap, kb.key, kb.keycode, kb.handler, - kb.arg); + ret += std::format("\n\tmodmask: {}\n\tsubmap: {}\n\tkey: {}\n\tkeycode: {}\n\tcatchall: {}\n\tdispatcher: {}\n\targ: {}\n\n", kb.modmask, kb.submap, kb.key, + kb.keycode, kb.catchAll, kb.handler, kb.arg); } } else { // json @@ -737,11 +737,13 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) { "submap": "{}", "key": "{}", "keycode": {}, + "catch_all": {}, "dispatcher": "{}", "arg": "{}" }},)#", kb.locked ? "true" : "false", kb.mouse ? "true" : "false", kb.release ? "true" : "false", kb.repeat ? "true" : "false", kb.nonConsuming ? "true" : "false", - kb.modmask, escapeJSONStrings(kb.submap), escapeJSONStrings(kb.key), kb.keycode, escapeJSONStrings(kb.handler), escapeJSONStrings(kb.arg)); + kb.modmask, escapeJSONStrings(kb.submap), escapeJSONStrings(kb.key), kb.keycode, kb.catchAll ? "true" : "false", escapeJSONStrings(kb.handler), + escapeJSONStrings(kb.arg)); } trimTrailingComma(ret); ret += "]"; |
