mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-05 14:42:01 -07:00
Added an Event Hook System (#1578)
* added an eventHookSystem * Add all socket2 events to hooks
This commit is contained in:
@@ -792,6 +792,7 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||
PWORKSPACETOCHANGETO->startAnim(true, ANIMTOLEFT);
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"workspace", PWORKSPACETOCHANGETO->m_szName});
|
||||
EMIT_HOOK_EVENT("workspace", PWORKSPACETOCHANGETO);
|
||||
}
|
||||
|
||||
// If the monitor is not the one our cursor's at, warp to it.
|
||||
@@ -885,6 +886,7 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||
g_pCompositor->warpCursorTo(PMONITOR->vecPosition + PMONITOR->vecSize / 2.f);
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"workspace", PWORKSPACE->m_szName});
|
||||
EMIT_HOOK_EVENT("workspace", PWORKSPACE);
|
||||
|
||||
g_pCompositor->setActiveMonitor(PMONITOR);
|
||||
|
||||
@@ -1066,6 +1068,7 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||
|
||||
// manually post event cuz it got ignored above
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", PWINDOW, PWORKSPACE->m_szName.c_str())});
|
||||
EMIT_HOOK_EVENT("moveWindow", (std::vector<void*>{PWINDOW, PWORKSPACE}));
|
||||
|
||||
PWINDOW->m_iWorkspaceID = OLDWORKSPACEIDRETURN;
|
||||
const auto PNEXTCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(PWINDOW);
|
||||
@@ -1702,6 +1705,7 @@ void CKeybindManager::setSubmap(std::string submap) {
|
||||
m_szCurrentSelectedSubmap = "";
|
||||
Debug::log(LOG, "Reset active submap to the default one.");
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"submap", ""});
|
||||
EMIT_HOOK_EVENT("submap", m_szCurrentSelectedSubmap);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1710,6 +1714,7 @@ void CKeybindManager::setSubmap(std::string submap) {
|
||||
m_szCurrentSelectedSubmap = submap;
|
||||
Debug::log(LOG, "Changed keybind submap to %s", submap.c_str());
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"submap", submap});
|
||||
EMIT_HOOK_EVENT("submap", m_szCurrentSelectedSubmap);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user