Skip to content

Commit

Permalink
hyprctl: add modkeys to binds command
Browse files Browse the repository at this point in the history
  • Loading branch information
davc0n committed Nov 28, 2024
1 parent 22bf285 commit be7bd7b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
25 changes: 22 additions & 3 deletions src/config/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2275,9 +2275,28 @@ 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, 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 {};
Expand Down
10 changes: 6 additions & 4 deletions src/debug/HyprCtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -847,6 +847,7 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
"non_consuming": {},
"has_description": {},
"modmask": {},
"modkeys": "{}",
"submap": "{}",
"key": "{}",
"keycode": {},
Expand All @@ -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 += "]";
Expand Down
1 change: 1 addition & 0 deletions src/managers/KeybindManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct SKeybind {
uint32_t keycode = 0;
bool catchAll = false;
uint32_t modmask = 0;
std::string modkeys = "";
std::set<xkb_keysym_t> sMkMods = {};
std::string handler = "";
std::string arg = "";
Expand Down

0 comments on commit be7bd7b

Please sign in to comment.