46 lines
907 B
C++
46 lines
907 B
C++
#pragma once
|
|
|
|
#include <glibmm.h>
|
|
#include <map>
|
|
#include <sigc++/sigc++.h>
|
|
#include <string>
|
|
|
|
class HyprlandService
|
|
{
|
|
typedef struct WorkspaceState
|
|
{
|
|
int id;
|
|
bool active;
|
|
bool focused;
|
|
bool urgent;
|
|
} WorkspaceState;
|
|
|
|
typedef struct Monitor
|
|
{
|
|
std::map<int, WorkspaceState> workspaceStates;
|
|
std::string name;
|
|
int x;
|
|
int y;
|
|
int id;
|
|
int focusedWorkspaceId;
|
|
} Monitor;
|
|
|
|
public:
|
|
HyprlandService();
|
|
~HyprlandService();
|
|
|
|
sigc::signal<void(std::string, std::string)> on_event;
|
|
|
|
void start();
|
|
void on_hyprland_event(std::string event, std::string data);
|
|
|
|
private:
|
|
int m_fd = -1;
|
|
std::string m_buffer;
|
|
std::map<int, Monitor> monitors;
|
|
|
|
bool on_socket_read(Glib::IOCondition condition);
|
|
void parse_message(const std::string &line);
|
|
std::string get_socket_path();
|
|
};
|