| 178 | } |
| 179 | |
| 180 | void Workspaces::initializeWorkspaces() { |
| 181 | spdlog::debug("Initializing workspaces"); |
| 182 | |
| 183 | // if the workspace rules changed since last initialization, make sure we reset everything: |
| 184 | for (auto& workspace : m_workspaces) { |
| 185 | m_workspacesToRemove.push_back(std::to_string(workspace->id())); |
| 186 | } |
| 187 | |
| 188 | // get all current workspaces |
| 189 | auto const workspacesJson = m_ipc.getSocket1JsonReply("workspaces"); |
| 190 | auto const clientsJson = m_ipc.getSocket1JsonReply("clients"); |
| 191 | |
| 192 | for (Json::Value workspaceJson : workspacesJson) { |
| 193 | std::string workspaceName = workspaceJson["name"].asString(); |
| 194 | if ((allOutputs() || m_bar.output->name == workspaceJson["monitor"].asString()) && |
| 195 | (!workspaceName.starts_with("special") || showSpecial()) && |
| 196 | !isWorkspaceIgnored(workspaceName)) { |
| 197 | m_workspacesToCreate.emplace_back(workspaceJson, clientsJson); |
| 198 | } else { |
| 199 | extendOrphans(workspaceJson["id"].asInt(), clientsJson); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | spdlog::debug("Initializing persistent workspaces"); |
| 204 | if (m_persistentWorkspaceConfig.isObject()) { |
| 205 | // a persistent workspace config is defined, so use that instead of workspace rules |
| 206 | loadPersistentWorkspacesFromConfig(clientsJson); |
| 207 | } |
| 208 | // load Hyprland's workspace rules |
| 209 | loadPersistentWorkspacesFromWorkspaceRules(clientsJson); |
| 210 | } |
| 211 | |
| 212 | bool isDoubleSpecial(std::string const& workspace_name) { |
| 213 | // Hyprland's IPC sometimes reports the creation of workspaces strangely named |
nothing calls this directly
no test coverage detected