i3/ipc: ensure workspace does not exist at init before model add

This commit is contained in:
outfoxxed committed 2025-01-31 23:28:14 -08:00
1 parent fb326e0e9c
commit 50026f0934
1 file changed
+6 -3
+6 -3
View File
@@ -401,8 +401,9 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
auto workspaceData = event->mData["current"];
auto* workspace = this->findWorkspaceByID(workspaceData["id"].toInt(-1));
auto existed = workspace != nullptr;
if (workspace == nullptr) {
if (!existed) {
workspace = new I3Workspace(this);
}
@@ -410,8 +411,10 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
workspace->updateFromObject(workspaceData.toObject().toVariantMap());
}
this->mWorkspaces.insertObject(workspace);
qCInfo(logI3Ipc) << "Added workspace" << workspace->name() << "to list";
if (!existed) {
this->mWorkspaces.insertObject(workspace);
qCInfo(logI3Ipc) << "Added workspace" << workspace->name() << "to list";
}
} else if (change == "focus") {
auto oldData = event->mData["old"];
auto newData = event->mData["current"];