refactor and shizz

This commit is contained in:
2025-12-25 21:13:00 +01:00
parent a06c96f648
commit 9b5db719cb
27 changed files with 286 additions and 312 deletions

View File

@@ -5,9 +5,12 @@
#include <map>
#include <sigc++/sigc++.h>
#include <string>
#include <sys/stat.h>
#include <vector>
class HyprlandService {
inline static HyprlandService *instance = nullptr;
public:
static constexpr int kWorkspaceSlotCount = 7;
const char *kMonitorCommand = "hyprctl monitors -j";
@@ -36,9 +39,6 @@ class HyprlandService {
int focusedWorkspaceId = -1;
};
HyprlandService();
~HyprlandService();
void start();
void on_hyprland_event(std::string event, std::string data);
void printMonitor(const Monitor &mon) const;
@@ -55,11 +55,21 @@ class HyprlandService {
return this->workspaces;
}
static HyprlandService *getInstance() {
if (HyprlandService::instance == nullptr) {
HyprlandService::instance = new HyprlandService();
}
return HyprlandService::instance;
}
private:
HyprlandService();
~HyprlandService();
int fd = -1;
std::map<int, Monitor> monitors;
std::map<int, WorkspaceState *> workspaces;
// persistent buffer for socket reads to handle partial messages
std::string socket_buffer;
std::string get_socket_path();