update m_output

pull/2968/head
Jannik 2024-02-25 00:51:52 +01:00
parent 601af3de81
commit 16079eae09
No known key found for this signature in database
2 changed files with 11 additions and 0 deletions

View File

@ -82,6 +82,7 @@ class Workspace {
void setVisible(bool value = true) { m_isVisible = value; }; void setVisible(bool value = true) { m_isVisible = value; };
void setWindows(uint value) { m_windows = value; }; void setWindows(uint value) { m_windows = value; };
void setName(std::string const& value) { m_name = value; }; void setName(std::string const& value) { m_name = value; };
void setOutput(std::string const& value) { m_output = value; };
bool containsWindow(WindowAddress const& addr) const { return m_windowMap.contains(addr); } bool containsWindow(WindowAddress const& addr) const { return m_windowMap.contains(addr); }
void insertWindow(WindowCreationPayload create_window_paylod); void insertWindow(WindowCreationPayload create_window_paylod);
std::string removeWindow(WindowAddress const& addr); std::string removeWindow(WindowAddress const& addr);

View File

@ -208,6 +208,7 @@ void Workspaces::doUpdate() {
} }
spdlog::trace("Updating workspace states"); spdlog::trace("Updating workspace states");
auto IPC_workspaces = gIPC->getSocket1JsonReply("workspaces");
for (auto &workspace : m_workspaces) { for (auto &workspace : m_workspaces) {
// active // active
workspace->setActive(workspace->name() == m_activeWorkspaceName || workspace->setActive(workspace->name() == m_activeWorkspaceName ||
@ -226,6 +227,15 @@ void Workspaces::doUpdate() {
if (m_withIcon) { if (m_withIcon) {
workspaceIcon = workspace->selectIcon(m_iconsMap); 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); workspace->update(m_format, workspaceIcon);
} }