diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-02-22 23:30:10 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-22 23:30:10 +0000 |
| commit | b88813c7efa4b7b0c5fe01471c5fa5b67a61dc7e (patch) | |
| tree | 4454e82bc033d7e28a23ee372d0e3f48341d0aaa /src/desktop/history/WorkspaceHistoryTracker.cpp | |
| parent | b4ee4674f9a74e3d602c7fb17bc09f79d221583c (diff) | |
event: refactor HookSystem into a typed event bus (#13333)
Refactors the old HookSystem into a typed event bus with clear
separation,
discovery and types.
Diffstat (limited to 'src/desktop/history/WorkspaceHistoryTracker.cpp')
| -rw-r--r-- | src/desktop/history/WorkspaceHistoryTracker.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
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 <hyprutils/utils/ScopeGuard.hpp> @@ -18,14 +18,9 @@ SP<CWorkspaceHistoryTracker> History::workspaceTracker() { } CWorkspaceHistoryTracker::CWorkspaceHistoryTracker() { - static auto P = g_pHookSystem->hookDynamic("workspace", [this](void* self, SCallbackInfo& info, std::any data) { - auto workspace = std::any_cast<PHLWORKSPACE>(data); - track(workspace); - }); - - static auto P1 = g_pHookSystem->hookDynamic("focusedMon", [this](void* self, SCallbackInfo& info, std::any data) { - auto mon = std::any_cast<PHLMONITOR>(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 |
