refactor and shizz
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user