#pragma once #include #include "../helpers/MiscFunctions.hpp" #include "../helpers/defer/Promise.hpp" #include "../desktop/Window.hpp" #include #include #include // exposed for main.cpp std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request); std::string versionRequest(eHyprCtlOutputFormat format, std::string request); class CHyprCtl { public: CHyprCtl(); ~CHyprCtl(); std::string makeDynamicCall(const std::string& input); SP registerCommand(SHyprCtlCommand cmd); void unregisterCommand(const SP& cmd); std::string getReply(std::string); Hyprutils::OS::CFileDescriptor m_socketFD; struct { bool all = false; bool sysInfoConfig = false; pid_t pid = 0; SP> pendingPromise; } m_currentRequestParams; static std::string getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format); static std::string getWorkspaceData(PHLWORKSPACE w, eHyprCtlOutputFormat format); static std::string getSolitaryBlockedReason(Hyprutils::Memory::CSharedPointer m, eHyprCtlOutputFormat format); static std::string getDSBlockedReason(Hyprutils::Memory::CSharedPointer m, eHyprCtlOutputFormat format); static std::string getTearingBlockedReason(Hyprutils::Memory::CSharedPointer m, eHyprCtlOutputFormat format); static std::string getMonitorData(Hyprutils::Memory::CSharedPointer m, eHyprCtlOutputFormat format); private: void startHyprCtlSocket(); std::vector> m_commands; wl_event_source* m_eventSource = nullptr; std::string m_socketPath; }; inline UP g_pHyprCtl;