fix urgent window icons

This commit is contained in:
2025-12-17 23:34:12 +01:00
parent 11ccd55a52
commit 9b0a036925
11 changed files with 172 additions and 194 deletions

View File

@@ -10,26 +10,29 @@
class HyprlandService {
public:
static constexpr int kWorkspaceSlotCount = 7;
const char *kMonitorCommand = "hyprctl monitors -j";
const char *kWorkspaceCommand = "hyprctl workspaces -j";
const char *kClientsCommand = "hyprctl clients -j";
struct WindowState {
int hyprId = -1;
};
struct WorkspaceState {
int hyprId = -1;
int hyprId = -1;
int monitorId = -1;
bool active = false;
bool focused = false;
std::vector<int> urgentWindows;
bool active = false;
bool focused = false;
std::vector<std::string> urgentWindows;
std::string label;
};
struct Monitor {
std::map<int, WorkspaceState*> workspaceStates;
std::map<int, WorkspaceState *> workspaceStates;
std::string name;
int x = 0;
int y = 0;
int id = -1;
int x = 0;
int y = 0;
int id = -1;
int focusedWorkspaceId = -1;
};
@@ -38,7 +41,6 @@ class HyprlandService {
void start();
void on_hyprland_event(std::string event, std::string data);
void printMonitor(const Monitor &mon) const;
sigc::signal<void(std::string, std::string)> socketEventSignal;
@@ -46,24 +48,23 @@ class HyprlandService {
sigc::signal<void()> monitorStateChanged;
Monitor *getMonitorById(int id);
const Monitor *getMonitorById(int id) const;
Monitor *getMonitorByIndex(std::size_t index);
const Monitor *getMonitorByIndex(std::size_t index) const;
void switchToWorkspace(int workspaceId);
std::map<int, WorkspaceState*> getAllWorkspaces() const {
return this->workspaces;
std::map<int, WorkspaceState *> getAllWorkspaces() const {
return this->workspaces;
}
private:
int fd = -1;
std::map<int, Monitor> monitors;
std::map<int, WorkspaceState*> workspaces;
std::map<int, WorkspaceState *> workspaces;
std::string get_socket_path();
bool on_socket_read(Glib::IOCondition condition);
void parse_message(const std::string &line);
void refresh_monitors();
void refresh_workspaces();
void handle_urgent_window(std::string windowAddress);
void onUrgentEvent(std::string windowAddress);
void onActiveWindowEvent(std::string windowAddress);
};