update m_output

This commit is contained in:
Jannik
2024-02-25 00:51:52 +01:00
parent 601af3de81
commit 16079eae09
2 changed files with 11 additions and 0 deletions

View File

@ -208,6 +208,7 @@ void Workspaces::doUpdate() {
}
spdlog::trace("Updating workspace states");
auto IPC_workspaces = gIPC->getSocket1JsonReply("workspaces");
for (auto &workspace : m_workspaces) {
// active
workspace->setActive(workspace->name() == m_activeWorkspaceName ||
@ -226,6 +227,15 @@ void Workspaces::doUpdate() {
if (m_withIcon) {
workspaceIcon = workspace->selectIcon(m_iconsMap);
}
// update m_output
auto IPC_workspace = std::find_if(IPC_workspaces.begin(), IPC_workspaces.end(), [&workspace](auto &w) {
auto wNameRaw = w["name"].asString();
auto wName = wNameRaw.starts_with("special:") ? wNameRaw.substr(8) : wNameRaw;
return wName == workspace->name();
});
workspace->setOutput((*IPC_workspace)["monitor"].asString());
workspace->update(m_format, workspaceIcon);
}