globals.hpp
1370 bytes
1#pragma once
2
3#include <set>
4#include <vector>
5
6#include <hyprland/src/desktop/Workspace.hpp>
7#include <hyprland/src/config/ConfigValue.hpp>
8#include <hyprland/src/plugins/PluginAPI.hpp>
9#include <hyprlang.hpp>
10
11#include "Hy3Layout.hpp"
12#include "TabGroup.hpp"
13#include "config/shared/complex/ComplexDataType.hpp"
14
15inline HANDLE PHANDLE = nullptr;
16
17// Suppress algorithm callbacks (newTarget/movedTarget/removeTarget) during
18// cross-workspace moves where we manually manage the tree.
19inline bool g_suppressInsert = false;
20
21inline std::set<Hy3Layout*> g_hy3Instances;
22
23inline std::vector<WP<Hy3TabGroup>> g_tabGroups;
24inline std::vector<UP<Hy3TabGroup>> g_destroyingTabGroups;
25
26inline CHyprSignalListener g_renderListener;
27inline CHyprSignalListener g_tickListener;
28inline CHyprSignalListener g_windowTitleListener;
29inline CHyprSignalListener g_urgentListener;
30
31inline Hy3Layout* hy3InstanceForWorkspace(PHLWORKSPACE ws) {
32 if (!ws || !ws->m_space || !ws->m_space->algorithm()) return nullptr;
33 return dynamic_cast<Hy3Layout*>(ws->m_space->algorithm()->tiledAlgo().get());
34}
35
36inline void errorNotif() {
37 HyprlandAPI::addNotificationV2(
38 PHANDLE,
39 {
40 {"text", "Something has gone very wrong. Check the log for details."},
41 {"time", (uint64_t) 10000},
42 {"color", CHyprColor(1.0, 0.0, 0.0, 1.0)},
43 {"icon", ICON_ERROR},
44 }
45 );
46}