#pragma once #include #include #include #include #include class HyprlandService { typedef struct WorkspaceState { int id; bool active; bool focused; bool urgent; } WorkspaceState; typedef struct Monitor { std::map workspaceStates; std::string name; int x; int y; int id; int focusedWorkspaceId; } Monitor; public: HyprlandService(); ~HyprlandService(); // For debugging purposes void printMonitor(const Monitor mon) { std::cout << "=== Monitor Info ===\n"; std::cout << "Name: " << mon.name << " (ID: " << mon.id << ")\n"; std::cout << "Position: (" << mon.x << ", " << mon.y << ")\n"; std::cout << "Focused Workspace ID: " << mon.focusedWorkspaceId << "\n"; std::cout << "Workspaces:\n"; if (mon.workspaceStates.empty()) { std::cout << " (None)\n"; } else { for (const auto& pair : mon.workspaceStates) { const WorkspaceState ws = pair.second; std::cout << " - [ID: " << ws.id << "] " << "Active: " << (ws.active ? "Yes" : "No") << " | " << "Focused: " << (ws.focused ? "Yes" : "No") << " | " << "Urgent: " << (ws.urgent ? "Yes" : "No") << "\n"; } } std::cout << "====================\n"; } sigc::signal socketEventSignal; void start(); void on_hyprland_event(std::string event, std::string data); private: int m_fd = -1; std::string m_buffer; std::map monitors; bool on_socket_read(Glib::IOCondition condition); void parse_message(const std::string &line); std::string get_socket_path(); };