keybinds: refactor dispatchers to be better (#7331)

This commit is contained in:
Ikalco 2024-08-24 11:45:53 -05:00 committed by GitHub
parent 82c67e61a9
commit 66586c38f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 457 additions and 305 deletions

View file

@ -962,11 +962,11 @@ std::string dispatchRequest(eHyprCtlOutputFormat format, std::string in) {
if (DISPATCHER == g_pKeybindManager->m_mDispatchers.end())
return "Invalid dispatcher";
DISPATCHER->second(DISPATCHARG);
SDispatchResult res = DISPATCHER->second(DISPATCHARG);
Debug::log(LOG, "Hyprctl: dispatcher {} : {}", DISPATCHSTR, DISPATCHARG);
Debug::log(LOG, "Hyprctl: dispatcher {} : {}{}", DISPATCHSTR, DISPATCHARG, res.success ? "" : " -> " + res.error);
return "ok";
return res.success ? "ok" : res.error;
}
std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {