summaryrefslogtreecommitdiff
path: root/src/plugins/PluginAPI.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-12-19 20:23:32 +0000
committerVaxry <vaxry@vaxry.net>2024-12-19 20:23:32 +0000
commit71dc9f6128b8d2e382b2a574d2d5f15e2d907f3a (patch)
tree0b677e89a5bd3ffe2942078bd91bb0933ceb8ee7 /src/plugins/PluginAPI.cpp
parentfd67ee9ecdc7207939fe1dcea9b81050ec7d58c4 (diff)
pluginAPI: add register dispatcher v2
Diffstat (limited to 'src/plugins/PluginAPI.cpp')
-rw-r--r--src/plugins/PluginAPI.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/PluginAPI.cpp b/src/plugins/PluginAPI.cpp
index 4172a856..5e1d9e58 100644
--- a/src/plugins/PluginAPI.cpp
+++ b/src/plugins/PluginAPI.cpp
@@ -202,6 +202,19 @@ APICALL bool HyprlandAPI::addDispatcher(HANDLE handle, const std::string& name,
return true;
}
+APICALL bool HyprlandAPI::addDispatcherV2(HANDLE handle, const std::string& name, std::function<SDispatchResult(std::string)> handler) {
+ auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
+
+ if (!PLUGIN)
+ return false;
+
+ PLUGIN->registeredDispatchers.push_back(name);
+
+ g_pKeybindManager->m_mDispatchers[name] = handler;
+
+ return true;
+}
+
APICALL bool HyprlandAPI::removeDispatcher(HANDLE handle, const std::string& name) {
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);