From 9ef6dc7380f863573346c25524f8cc7884d381d1 Mon Sep 17 00:00:00 2001 From: Skylar Abruzese Date: Thu, 3 Jul 2025 17:44:37 -0400 Subject: [PATCH 1/2] fix: hyprland named persistent workspaces allowed persistent workspaces to be defined with names instead of just id's --- src/modules/hyprland/workspaces.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/hyprland/workspaces.cpp b/src/modules/hyprland/workspaces.cpp index bb03f707..8dcd9b0e 100644 --- a/src/modules/hyprland/workspaces.cpp +++ b/src/modules/hyprland/workspaces.cpp @@ -253,10 +253,8 @@ void Workspaces::loadPersistentWorkspacesFromConfig(Json::Value const &clientsJs // value is an array => create defined workspaces for this monitor if (canCreate) { for (const Json::Value &workspace : value) { - if (workspace.isInt()) { - spdlog::debug("Creating workspace {} on monitor {}", workspace, currentMonitor); - persistentWorkspacesToCreate.emplace_back(std::to_string(workspace.asInt())); - } + spdlog::debug("Creating workspace {} on monitor {}", workspace, currentMonitor); + persistentWorkspacesToCreate.emplace_back(workspace.asString()); } } else { // key is the workspace and value is array of monitors to create on From 6d3b93bbf7e6f069a3c3f8539745989938a4dfea Mon Sep 17 00:00:00 2001 From: Skylar Abruzese Date: Thu, 3 Jul 2025 18:48:04 -0400 Subject: [PATCH 2/2] fix: added active workspace matching by name as fallback fixes bug where persistent workspaces would not be marked as active because their id is based on creation time by hyprland and thus we can't consistently match the id's without constantly changing them (this would also cause issues with workspace sorting). --- src/modules/hyprland/workspaces.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/hyprland/workspaces.cpp b/src/modules/hyprland/workspaces.cpp index 8dcd9b0e..1f61e267 100644 --- a/src/modules/hyprland/workspaces.cpp +++ b/src/modules/hyprland/workspaces.cpp @@ -942,9 +942,17 @@ bool Workspaces::updateWindowsToCreate() { void Workspaces::updateWorkspaceStates() { const std::vector visibleWorkspaces = getVisibleWorkspaces(); auto updatedWorkspaces = m_ipc.getSocket1JsonReply("workspaces"); + + auto currentWorkspace = m_ipc.getSocket1JsonReply("activeworkspace"); + std::string currentWorkspaceName = + currentWorkspace.isMember("name") ? currentWorkspace["name"].asString() : ""; + for (auto &workspace : m_workspaces) { + bool isActiveByName = + !currentWorkspaceName.empty() && workspace->name() == currentWorkspaceName; + workspace->setActive( - workspace->id() == m_activeWorkspaceId || + workspace->id() == m_activeWorkspaceId || isActiveByName || (workspace->isSpecial() && workspace->name() == m_activeSpecialWorkspaceName)); if (workspace->isActive() && workspace->isUrgent()) { workspace->setUrgent(false);