fix title not showing for special workspaces (seperate outputs: false

This commit is contained in:
Jannik
2024-02-24 18:16:43 +01:00
parent 0cbb280de6
commit 9f5c27c6e0
2 changed files with 4 additions and 10 deletions
+4 -9
View File
@@ -84,17 +84,12 @@ auto Window::update() -> void {
AAppIconLabel::update();
}
auto Window::getActiveWorkspace() -> Workspace {
const auto workspace = gIPC->getSocket1JsonReply("activeworkspace");
assert(workspace.isObject());
return Workspace::parse(workspace);
}
auto Window::getActiveWorkspace(const std::string& monitorName) -> Workspace {
auto Window::getActiveWorkspace(const std::string& monitorName = "") -> Workspace {
const auto monitors = gIPC->getSocket1JsonReply("monitors");
assert(monitors.isArray());
auto monitor = std::find_if(monitors.begin(), monitors.end(),
[&](Json::Value monitor) { return monitor["name"] == monitorName; });
auto monitor = std::find_if(monitors.begin(), monitors.end(), [&](Json::Value monitor) {
return monitorName == "" ? monitor["focused"].asBool() : monitor["name"] == monitorName;
});
if (monitor == std::end(monitors)) {
spdlog::warn("Monitor not found: {}", monitorName);
return Workspace{-1, 0, "", ""};