From b88813c7efa4b7b0c5fe01471c5fa5b67a61dc7e Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sun, 22 Feb 2026 23:30:10 +0000 Subject: event: refactor HookSystem into a typed event bus (#13333) Refactors the old HookSystem into a typed event bus with clear separation, discovery and types. --- src/desktop/history/WorkspaceHistoryTracker.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/desktop/history/WorkspaceHistoryTracker.cpp') diff --git a/src/desktop/history/WorkspaceHistoryTracker.cpp b/src/desktop/history/WorkspaceHistoryTracker.cpp index 0b4ef2fd..daa115f8 100644 --- a/src/desktop/history/WorkspaceHistoryTracker.cpp +++ b/src/desktop/history/WorkspaceHistoryTracker.cpp @@ -3,8 +3,8 @@ #include "../../helpers/Monitor.hpp" #include "../Workspace.hpp" #include "../state/FocusState.hpp" -#include "../../managers/HookSystemManager.hpp" #include "../../managers/eventLoop/EventLoopManager.hpp" +#include "../../event/EventBus.hpp" #include "../../config/ConfigValue.hpp" #include @@ -18,14 +18,9 @@ SP History::workspaceTracker() { } CWorkspaceHistoryTracker::CWorkspaceHistoryTracker() { - static auto P = g_pHookSystem->hookDynamic("workspace", [this](void* self, SCallbackInfo& info, std::any data) { - auto workspace = std::any_cast(data); - track(workspace); - }); - - static auto P1 = g_pHookSystem->hookDynamic("focusedMon", [this](void* self, SCallbackInfo& info, std::any data) { - auto mon = std::any_cast(data); + static auto P = Event::bus()->m_events.workspace.active.listen([this](PHLWORKSPACE workspace) { track(workspace); }); + static auto P1 = Event::bus()->m_events.monitor.focused.listen([this](PHLMONITOR mon) { // This sucks ASS, but we have to do this because switching to a workspace on another mon will trigger a workspace event right afterwards and we don't // want to remember the workspace that was not visible there // TODO: do something about this -- cgit v1.2.3