From be7bd7b5001c88166b8f137c627928558a4eb00e Mon Sep 17 00:00:00 2001 From: Davide Conti Date: Thu, 28 Nov 2024 21:01:24 +0100 Subject: [PATCH 1/2] hyprctl: add modkeys to binds command closes #8606 --- src/config/ConfigManager.cpp | 25 ++++++++++++++++++++++--- src/debug/HyprCtl.cpp | 10 ++++++---- src/managers/KeybindManager.hpp | 1 + 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index c0f212cf706..4def523d7f5 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2275,9 +2275,28 @@ std::optional 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, longPress, - mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription, dontInhibit}); + g_pKeybindManager->addKeybind(SKeybind{parsedKey.key, + KEYSYMS, + parsedKey.keycode, + parsedKey.catchAll, + MOD, + MODSTR, + MODS, + HANDLER, + COMMAND, + locked, + m_szCurrentSubmap, + DESCRIPTION, + release, + repeat, + longPress, + mouse, + nonConsuming, + transparent, + ignoreMods, + multiKey, + hasDescription, + dontInhibit}); } return {}; diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 11c16f0eee0..8b01b7baaef 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -829,8 +829,8 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) { if (kb->hasDescription) ret += "d"; - ret += std::format("\n\tmodmask: {}\n\tsubmap: {}\n\tkey: {}\n\tkeycode: {}\n\tcatchall: {}\n\tdescription: {}\n\tdispatcher: {}\n\targ: {}\n\n", kb->modmask, - kb->submap, kb->key, kb->keycode, kb->catchAll, kb->description, kb->handler, kb->arg); + ret += std::format("\n\tmodmask: {}\n\tmodkeys: {}\n\tsubmap: {}\n\tkey: {}\n\tkeycode: {}\n\tcatchall: {}\n\tdescription: {}\n\tdispatcher: {}\n\targ: {}\n\n", + kb->modmask, kb->modkeys, kb->submap, kb->key, kb->keycode, kb->catchAll, kb->description, kb->handler, kb->arg); } } else { // json @@ -847,6 +847,7 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) { "non_consuming": {}, "has_description": {}, "modmask": {}, + "modkeys": "{}", "submap": "{}", "key": "{}", "keycode": {}, @@ -856,8 +857,9 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) { "arg": "{}" }},)#", kb->locked ? "true" : "false", kb->mouse ? "true" : "false", kb->release ? "true" : "false", kb->repeat ? "true" : "false", kb->longPress ? "true" : "false", - kb->nonConsuming ? "true" : "false", kb->hasDescription ? "true" : "false", kb->modmask, escapeJSONStrings(kb->submap), escapeJSONStrings(kb->key), kb->keycode, - kb->catchAll ? "true" : "false", escapeJSONStrings(kb->description), escapeJSONStrings(kb->handler), escapeJSONStrings(kb->arg)); + kb->nonConsuming ? "true" : "false", kb->hasDescription ? "true" : "false", kb->modmask, escapeJSONStrings(kb->modkeys), escapeJSONStrings(kb->submap), + escapeJSONStrings(kb->key), kb->keycode, kb->catchAll ? "true" : "false", escapeJSONStrings(kb->description), escapeJSONStrings(kb->handler), + escapeJSONStrings(kb->arg)); } trimTrailingComma(ret); ret += "]"; diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp index 1f60fdd2afb..7a8f2fdd363 100644 --- a/src/managers/KeybindManager.hpp +++ b/src/managers/KeybindManager.hpp @@ -21,6 +21,7 @@ struct SKeybind { uint32_t keycode = 0; bool catchAll = false; uint32_t modmask = 0; + std::string modkeys = ""; std::set sMkMods = {}; std::string handler = ""; std::string arg = ""; From ccdbc0e64f8c0b807889583ee1d1555ce571efc0 Mon Sep 17 00:00:00 2001 From: Davide Conti Date: Thu, 28 Nov 2024 21:02:40 +0100 Subject: [PATCH 2/2] build: remove some not needed includes --- src/config/ConfigManager.cpp | 1 - src/debug/HyprCtl.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 4def523d7f5..9554e3ea51a 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -4,7 +4,6 @@ #include "../render/decorations/CHyprGroupBarDecoration.hpp" #include "config/ConfigDataValues.hpp" #include "config/ConfigValue.hpp" -#include "helpers/varlist/VarList.hpp" #include "../protocols/LayerShell.hpp" #include "../xwayland/XWayland.hpp" #include "../protocols/OutputManagement.hpp" diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 8b01b7baaef..ae0c66d8ab0 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include