From d4331ce7fe4268acdb2d74a6f6d39ce98059a1f7 Mon Sep 17 00:00:00 2001 From: Jannik Date: Fri, 9 Feb 2024 13:49:39 +0100 Subject: [PATCH] improve handling of special workspace name --- src/modules/hyprland/workspaces.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/modules/hyprland/workspaces.cpp b/src/modules/hyprland/workspaces.cpp index e4c02de1..78d59cf7 100644 --- a/src/modules/hyprland/workspaces.cpp +++ b/src/modules/hyprland/workspaces.cpp @@ -187,8 +187,7 @@ void Workspaces::doUpdate() { auto sws = monitor["specialWorkspace"]; auto name = sws["name"].asString(); if (sws.isObject() && (sws["name"].isString()) && !name.empty()) { - visibleWorkspaces.push_back(name == "special" ? "special" - : name.substr(8, name.length() - 8)); + visibleWorkspaces.push_back(name.starts_with("special:") ? name : name.substr(8)); } } @@ -307,9 +306,7 @@ void Workspaces::onWorkspaceActivated(std::string const &payload) { void Workspaces::onSpecialWorkspaceActivated(std::string const &payload) { std::string name(begin(payload), begin(payload) + payload.find_first_of(',')); - m_activeSpecialWorkspaceName = ( - ( name == "special" || name == "" ) ? name : name.substr(8, name.length() - 8) - ); + m_activeSpecialWorkspaceName = (!name.starts_with("special:") ? name : name.substr(8)); } void Workspaces::onWorkspaceDestroyed(std::string const &payload) {