Skip to content

Commit 50026f0

Browse files
committed
i3/ipc: ensure workspace does not exist at init before model add
1 parent fb326e0 commit 50026f0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/x11/i3/ipc/connection.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,20 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
401401
auto workspaceData = event->mData["current"];
402402

403403
auto* workspace = this->findWorkspaceByID(workspaceData["id"].toInt(-1));
404+
auto existed = workspace != nullptr;
404405

405-
if (workspace == nullptr) {
406+
if (!existed) {
406407
workspace = new I3Workspace(this);
407408
}
408409

409410
if (workspaceData.isObject()) {
410411
workspace->updateFromObject(workspaceData.toObject().toVariantMap());
411412
}
412413

413-
this->mWorkspaces.insertObject(workspace);
414-
qCInfo(logI3Ipc) << "Added workspace" << workspace->name() << "to list";
414+
if (!existed) {
415+
this->mWorkspaces.insertObject(workspace);
416+
qCInfo(logI3Ipc) << "Added workspace" << workspace->name() << "to list";
417+
}
415418
} else if (change == "focus") {
416419
auto oldData = event->mData["old"];
417420
auto newData = event->mData["current"];

0 commit comments

Comments
 (0)