Skip to content

Commit

Permalink
bugfix: persistent workspace not being removed when specifying differ…
Browse files Browse the repository at this point in the history
…ent monitor in rule
  • Loading branch information
zjeffer committed Dec 30, 2023
1 parent 8cd81bc commit 6680a86
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/modules/hyprland/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,7 @@ void Workspaces::createWorkspace(Json::Value const &workspace_data,

if (workspace != m_workspaces.end()) {
// don't recreate workspace, but update persistency if necessary
if (workspace_data["persistent"].asBool() and !(*workspace)->isPersistent()) {
spdlog::info("Setting workspace {} as persistent", workspaceName);
(*workspace)->setPersistent();
}
(*workspace)->setPersistent(workspace_data["persistent"].asBool());
return;
}
spdlog::info("Workspace {} does not exist yet, creating...", workspaceName);
Expand Down Expand Up @@ -562,6 +559,11 @@ void Workspaces::removeWorkspace(std::string const &name) {
void Workspaces::initializeWorkspaces() {
spdlog::debug("Initializing workspaces");

// if the workspace rules changed since last initialization, make sure we reset everything:
for (auto &workspace : m_workspaces) {
m_workspacesToRemove.push_back(workspace->name());
}

// get all current workspaces
auto const workspacesJson = gIPC->getSocket1JsonReply("workspaces");
auto const clientsJson = gIPC->getSocket1JsonReply("clients");
Expand Down Expand Up @@ -605,7 +607,9 @@ void Workspaces::initializeWorkspaces() {
workspaceData["monitor"] = monitor;
workspaceData["windows"] = 0;
workspaceData["persistent"] = true;
createWorkspace(workspaceData);
m_workspacesToCreate.push_back(workspaceData);
} else {
m_workspacesToRemove.push_back(workspace);
}
}
}
Expand Down

0 comments on commit 6680a86

Please sign in to comment.