forked from quickshell/quickshell
i3/ipc: ensure workspace does not exist at init before model add
This commit is contained in:
parent
fb326e0e9c
commit
50026f0934
1 changed files with 6 additions and 3 deletions
|
@ -401,8 +401,9 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
|
||||||
auto workspaceData = event->mData["current"];
|
auto workspaceData = event->mData["current"];
|
||||||
|
|
||||||
auto* workspace = this->findWorkspaceByID(workspaceData["id"].toInt(-1));
|
auto* workspace = this->findWorkspaceByID(workspaceData["id"].toInt(-1));
|
||||||
|
auto existed = workspace != nullptr;
|
||||||
|
|
||||||
if (workspace == nullptr) {
|
if (!existed) {
|
||||||
workspace = new I3Workspace(this);
|
workspace = new I3Workspace(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,8 +411,10 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
|
||||||
workspace->updateFromObject(workspaceData.toObject().toVariantMap());
|
workspace->updateFromObject(workspaceData.toObject().toVariantMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
this->mWorkspaces.insertObject(workspace);
|
if (!existed) {
|
||||||
qCInfo(logI3Ipc) << "Added workspace" << workspace->name() << "to list";
|
this->mWorkspaces.insertObject(workspace);
|
||||||
|
qCInfo(logI3Ipc) << "Added workspace" << workspace->name() << "to list";
|
||||||
|
}
|
||||||
} else if (change == "focus") {
|
} else if (change == "focus") {
|
||||||
auto oldData = event->mData["old"];
|
auto oldData = event->mData["old"];
|
||||||
auto newData = event->mData["current"];
|
auto newData = event->mData["current"];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue