Add IPC event when a window is selected

This commit is contained in:
Zakk
2024-06-10 03:30:13 -04:00
parent ebe3c7ca69
commit 22f8b82b0e
3 changed files with 4 additions and 2 deletions

View File

@@ -13,8 +13,8 @@ CHyprEasyLabel::CHyprEasyLabel(PHLWINDOW pWindow, SMotionActionDesc *actionDesc)
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
PMONITOR->scheduledRecalc = true;
std::string windowAddr = std::format("0x{:x}", (uintptr_t)pWindow.get());
m_szActionCmd = std::vformat(actionDesc->commandString, std::make_format_args(windowAddr));
m_szWindowAddress = std::format("0x{:x}", (uintptr_t)pWindow.get());
m_szActionCmd = std::vformat(actionDesc->commandString, std::make_format_args(m_szWindowAddress));
m_iTextSize = actionDesc->textSize;
m_cTextColor = actionDesc->textColor;
m_cBackgroundColor = actionDesc->backgroundColor;

View File

@@ -38,6 +38,7 @@ class CHyprEasyLabel : public IHyprWindowDecoration {
std::string m_szLabel;
std::string m_szActionCmd;
std::string m_szTextFont;
std::string m_szWindowAddress;
int m_iTextSize;
int m_iPaddingTop;
int m_iPaddingBottom;

View File

@@ -29,6 +29,7 @@ void easymotionActionDispatch(std::string args)
{
for (auto &ml : g_pGlobalState->motionLabels) {
if (ml->m_szLabel == args) {
g_pEventManager->postEvent(SHyprIPCEvent{"easymotionselect", std::format("{},{}", ml->m_szWindowAddress, ml->m_szLabel)});
g_pKeybindManager->m_mDispatchers["exec"](ml->m_szActionCmd);
easymotionExitDispatch("");
break;