small fixes

This commit is contained in:
arnaud-ma
2025-07-19 05:01:29 +02:00
parent 2dc2b5ccfd
commit 8dcdd97879
2 changed files with 11 additions and 7 deletions

View File

@ -119,6 +119,7 @@ class Workspaces : public AModule, public EventHandler {
void setCurrentMonitorId(); void setCurrentMonitorId();
void loadPersistentWorkspacesFromConfig(Json::Value const& clientsJson); void loadPersistentWorkspacesFromConfig(Json::Value const& clientsJson);
void loadPersistentWorkspacesFromWorkspaceRules(const Json::Value& clientsJson); void loadPersistentWorkspacesFromWorkspaceRules(const Json::Value& clientsJson);
bool m_allOutputs = false; bool m_allOutputs = false;
bool m_showSpecial = false; bool m_showSpecial = false;
bool m_activeOnly = false; bool m_activeOnly = false;

View File

@ -69,7 +69,8 @@ void Workspaces::createWorkspace(Json::Value const &workspace_data,
spdlog::debug("Creating workspace {}", workspaceName); spdlog::debug("Creating workspace {}", workspaceName);
// avoid recreating existing workspaces // avoid recreating existing workspaces
auto workspace = std::ranges::find_if(m_workspaces, [&](std::unique_ptr<Workspace> const &w) { auto workspace =
std::ranges::find_if(m_workspaces, [&](std::unique_ptr<Workspace> const &w) {
if (workspaceId > 0) { if (workspaceId > 0) {
return w->id() == workspaceId; return w->id() == workspaceId;
} }
@ -295,6 +296,8 @@ void Workspaces::loadPersistentWorkspacesFromWorkspaceRules(const Json::Value &c
} }
auto workspace = rule.isMember("defaultName") ? rule["defaultName"].asString() auto workspace = rule.isMember("defaultName") ? rule["defaultName"].asString()
: rule["workspaceString"].asString(); : rule["workspaceString"].asString();
// The prefix "name:" cause mismatches with workspace names taken anywhere else.
if (workspace.starts_with("name:")) { if (workspace.starts_with("name:")) {
workspace = workspace.substr(5); workspace = workspace.substr(5);
} }