improve handling of special workspace name

pull/2894/head
Jannik 2024-02-09 13:49:39 +01:00
parent 692f8f4ea4
commit d4331ce7fe
No known key found for this signature in database
1 changed files with 2 additions and 5 deletions

View File

@ -187,8 +187,7 @@ void Workspaces::doUpdate() {
auto sws = monitor["specialWorkspace"]; auto sws = monitor["specialWorkspace"];
auto name = sws["name"].asString(); auto name = sws["name"].asString();
if (sws.isObject() && (sws["name"].isString()) && !name.empty()) { if (sws.isObject() && (sws["name"].isString()) && !name.empty()) {
visibleWorkspaces.push_back(name == "special" ? "special" visibleWorkspaces.push_back(name.starts_with("special:") ? name : name.substr(8));
: name.substr(8, name.length() - 8));
} }
} }
@ -307,9 +306,7 @@ void Workspaces::onWorkspaceActivated(std::string const &payload) {
void Workspaces::onSpecialWorkspaceActivated(std::string const &payload) { void Workspaces::onSpecialWorkspaceActivated(std::string const &payload) {
std::string name(begin(payload), begin(payload) + payload.find_first_of(',')); std::string name(begin(payload), begin(payload) + payload.find_first_of(','));
m_activeSpecialWorkspaceName = ( m_activeSpecialWorkspaceName = (!name.starts_with("special:") ? name : name.substr(8));
( name == "special" || name == "" ) ? name : name.substr(8, name.length() - 8)
);
} }
void Workspaces::onWorkspaceDestroyed(std::string const &payload) { void Workspaces::onWorkspaceDestroyed(std::string const &payload) {