add popover component
This commit is contained in:
@@ -31,7 +31,7 @@ HyprlandService::~HyprlandService() {
|
||||
}
|
||||
|
||||
void HyprlandService::on_hyprland_event(std::string event, std::string data) {
|
||||
|
||||
|
||||
if (event == "urgent") {
|
||||
onUrgentEvent(data);
|
||||
}
|
||||
@@ -39,7 +39,7 @@ void HyprlandService::on_hyprland_event(std::string event, std::string data) {
|
||||
if (event == "activewindowv2") {
|
||||
onActiveWindowEvent(data);
|
||||
}
|
||||
|
||||
|
||||
if (event == "workspace" || event == "movewindow") {
|
||||
refresh_workspaces();
|
||||
}
|
||||
@@ -47,7 +47,7 @@ void HyprlandService::on_hyprland_event(std::string event, std::string data) {
|
||||
// use for
|
||||
// event == "focusedmon"
|
||||
|
||||
if (event == "monitoradded" || event == "monitorremoved") {
|
||||
if (event == "monitoradded" || event == "monitorremoved") {
|
||||
refresh_monitors();
|
||||
}
|
||||
}
|
||||
@@ -179,9 +179,9 @@ void HyprlandService::refresh_monitors() {
|
||||
wsState.label = std::to_string(slot);
|
||||
wsState.monitorId = monitor.id;
|
||||
|
||||
int id = slot + monitor.id * HyprlandService::kWorkspaceSlotCount;
|
||||
wsState.hyprId = id;
|
||||
this->workspaces[id] = new WorkspaceState(wsState);
|
||||
int id = slot + monitor.id * HyprlandService::kWorkspaceSlotCount;
|
||||
wsState.hyprId = id;
|
||||
this->workspaces[id] = new WorkspaceState(wsState);
|
||||
if (monitor.id >= 0) {
|
||||
this->monitors[monitor.id].workspaceStates[slot] = this->workspaces[id];
|
||||
}
|
||||
@@ -220,14 +220,14 @@ void HyprlandService::refresh_workspaces() {
|
||||
}
|
||||
|
||||
for (const auto &workspaceJson : workspacesJson) {
|
||||
const int workspaceId = workspaceJson.value("id", -1);
|
||||
const int workspaceId = workspaceJson.value("id", -1);
|
||||
auto workspaceStateIt = this->workspaces.find(workspaceId);
|
||||
if (workspaceStateIt == this->workspaces.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
WorkspaceState *workspaceState = workspaceStateIt->second;
|
||||
auto mit = this->monitors.find(workspaceState->monitorId);
|
||||
auto mit = this->monitors.find(workspaceState->monitorId);
|
||||
if (mit != this->monitors.end()) {
|
||||
workspaceState->focused = mit->second.focusedWorkspaceId == workspaceId;
|
||||
} else {
|
||||
@@ -270,7 +270,6 @@ void HyprlandService::onUrgentEvent(std::string windowAddress) {
|
||||
it->second->urgentWindows.push_back(windowAddress);
|
||||
workspaceStateChanged.emit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -287,10 +286,10 @@ void HyprlandService::onActiveWindowEvent(std::string windowAddress) {
|
||||
|
||||
if (addr == "0x" + windowAddress) {
|
||||
int workspaceId = clientJson["workspace"]["id"];
|
||||
auto it = this->workspaces.find(workspaceId);
|
||||
auto it = this->workspaces.find(workspaceId);
|
||||
if (it != this->workspaces.end() && it->second) {
|
||||
WorkspaceState *ws = it->second;
|
||||
auto uit = std::find(ws->urgentWindows.begin(), ws->urgentWindows.end(), windowAddress);
|
||||
auto uit = std::find(ws->urgentWindows.begin(), ws->urgentWindows.end(), windowAddress);
|
||||
if (uit != ws->urgentWindows.end()) {
|
||||
ws->urgentWindows.erase(uit);
|
||||
workspaceStateChanged.emit();
|
||||
|
||||
Reference in New Issue
Block a user