Update to new dispatcher plugin API.
Add pins for 0.46.x
This commit is contained in:
@@ -9,7 +9,10 @@ commit_pins = [
|
|||||||
["4520b30d498daca8079365bdb909a8dea38e8d55", "abb0a02a256041b0cd1b1d68de8c8d6de70a5b51"],
|
["4520b30d498daca8079365bdb909a8dea38e8d55", "abb0a02a256041b0cd1b1d68de8c8d6de70a5b51"],
|
||||||
["a425fbebe4cf4238e48a42f724ef2208959d66cf", "3388351d2af672f89b907404668c6076336270e9"],
|
["a425fbebe4cf4238e48a42f724ef2208959d66cf", "3388351d2af672f89b907404668c6076336270e9"],
|
||||||
["500d2a3580388afc8b620b0a3624147faa34f98b", "3388351d2af672f89b907404668c6076336270e9"],
|
["500d2a3580388afc8b620b0a3624147faa34f98b", "3388351d2af672f89b907404668c6076336270e9"],
|
||||||
["12f9a0d0b93f691d4d9923716557154d74777b0a", "3388351d2af672f89b907404668c6076336270e9"]
|
["12f9a0d0b93f691d4d9923716557154d74777b0a", "3388351d2af672f89b907404668c6076336270e9"],
|
||||||
|
["788ae588979c2a1ff8a660f16e3c502ef5796755", "138f2d3404904fb7f3868a4213c1fa7847417223"],
|
||||||
|
["254fc2bc6000075f660b4b8ed818a6af544d1d64", "138f2d3404904fb7f3868a4213c1fa7847417223"],
|
||||||
|
["0bd541f2fd902dbfa04c3ea2ccf679395e316887", "138f2d3404904fb7f3868a4213c1fa7847417223"]
|
||||||
]
|
]
|
||||||
[hyprEasymotion]
|
[hyprEasymotion]
|
||||||
description = "Easymotion"
|
description = "Easymotion"
|
||||||
|
|||||||
18
main.cpp
18
main.cpp
@@ -16,7 +16,7 @@ APICALL EXPORT std::string PLUGIN_API_VERSION() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void easymotionExitDispatch(std::string args)
|
SDispatchResult easymotionExitDispatch(std::string args)
|
||||||
{
|
{
|
||||||
for (auto &ml : g_pGlobalState->motionLabels | std::ranges::views::reverse) {
|
for (auto &ml : g_pGlobalState->motionLabels | std::ranges::views::reverse) {
|
||||||
ml->getOwner()->removeWindowDeco(ml);
|
ml->getOwner()->removeWindowDeco(ml);
|
||||||
@@ -24,9 +24,11 @@ void easymotionExitDispatch(std::string args)
|
|||||||
HyprlandAPI::invokeHyprctlCommand("dispatch", "submap reset");
|
HyprlandAPI::invokeHyprctlCommand("dispatch", "submap reset");
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"easymotionexit", ""});
|
g_pEventManager->postEvent(SHyprIPCEvent{"easymotionexit", ""});
|
||||||
|
|
||||||
|
return {};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void easymotionActionDispatch(std::string args)
|
SDispatchResult easymotionActionDispatch(std::string args)
|
||||||
{
|
{
|
||||||
for (auto &ml : g_pGlobalState->motionLabels) {
|
for (auto &ml : g_pGlobalState->motionLabels) {
|
||||||
if (ml->m_szLabel == args) {
|
if (ml->m_szLabel == args) {
|
||||||
@@ -36,6 +38,8 @@ void easymotionActionDispatch(std::string args)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void addEasyMotionKeybinds()
|
void addEasyMotionKeybinds()
|
||||||
@@ -99,7 +103,7 @@ static bool parseBorderGradient(std::string VALUE, CGradientValueData *DATA) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void easymotionDispatch(std::string args)
|
SDispatchResult easymotionDispatch(std::string args)
|
||||||
{
|
{
|
||||||
static auto *const TEXTSIZE = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:textsize")->getDataStaticPtr();
|
static auto *const TEXTSIZE = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:easymotion:textsize")->getDataStaticPtr();
|
||||||
|
|
||||||
@@ -184,6 +188,8 @@ void easymotionDispatch(std::string args)
|
|||||||
|
|
||||||
if (!g_pGlobalState->motionLabels.empty())
|
if (!g_pGlobalState->motionLabels.empty())
|
||||||
HyprlandAPI::invokeHyprctlCommand("dispatch", "submap __easymotionsubmap__");
|
HyprlandAPI::invokeHyprctlCommand("dispatch", "submap __easymotionsubmap__");
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oneasymotionKeypress(void *self, std::any data) {
|
bool oneasymotionKeypress(void *self, std::any data) {
|
||||||
@@ -233,9 +239,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
|||||||
|
|
||||||
|
|
||||||
g_pGlobalState = std::make_unique<SGlobalState>();
|
g_pGlobalState = std::make_unique<SGlobalState>();
|
||||||
HyprlandAPI::addDispatcher(PHANDLE, "easymotion", easymotionDispatch);
|
HyprlandAPI::addDispatcherV2(PHANDLE, "easymotion", easymotionDispatch);
|
||||||
HyprlandAPI::addDispatcher(PHANDLE, "easymotionaction", easymotionActionDispatch);
|
HyprlandAPI::addDispatcherV2(PHANDLE, "easymotionaction", easymotionActionDispatch);
|
||||||
HyprlandAPI::addDispatcher(PHANDLE, "easymotionexit", easymotionExitDispatch);
|
HyprlandAPI::addDispatcherV2(PHANDLE, "easymotionexit", easymotionExitDispatch);
|
||||||
static auto KPHOOK = HyprlandAPI::registerCallbackDynamic(PHANDLE, "keyPress", [&](void *self, SCallbackInfo &info, std::any data) {
|
static auto KPHOOK = HyprlandAPI::registerCallbackDynamic(PHANDLE, "keyPress", [&](void *self, SCallbackInfo &info, std::any data) {
|
||||||
info.cancelled = oneasymotionKeypress(self, data);
|
info.cancelled = oneasymotionKeypress(self, data);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user