#pragma once #include #include #include #include #include #include #include #include "components/workspaceIndicator.hpp" #include "gtkmm/box.h" #define NUM_WORKSPACES 7 class HyprlandService { inline static HyprlandService *instance = nullptr; public: struct WorkspaceState { int id; int monitorId; bool alive = false; // window count above 0 (exists in hyprctl workspaces array) bool presenting = false; // $(hyprctl monitors).activeWorkspace == id bool focused = false; // $(hyprctl monitors).activeWorkspace == id && (hyprctl monitors).focused bool urgent = false; // check ctl clients, and find ws with urgent window std::string label; }; struct Workspace { WorkspaceState state; std::shared_ptr view; }; struct Monitor { int id; int activeWorkspaceId; bool focused = false; std::string name; std::map> monitorWorkspaces; }; static HyprlandService *getInstance() { if (!instance) { instance = new HyprlandService(); } return instance; } std::shared_ptr getWorkspaceIndicatorsForMonitor(int monitorId); private: HyprlandService(); std::map> monitors; std::map> workspaces; /// maybe refactor into reusable class std::string socketBuffer; int socketFd; /// std::string getSocketPath(); void bindSocket(); void init(); void updateIndicator(Workspace &workspace, const WorkspaceState newState); };