Skip to content

Commit

Permalink
Merge pull request #3947 from zjeffer/fix/zjeffer/workspacerules-defa…
Browse files Browse the repository at this point in the history
…ultname

Fix workspacerules not taking into account defaultName
  • Loading branch information
Alexays authored Feb 20, 2025
2 parents c32d5e3 + bcee548 commit d3c7ff6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/modules/hyprland/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ void Workspaces::loadPersistentWorkspacesFromWorkspaceRules(const Json::Value &c
if (!rule["persistent"].asBool()) {
continue;
}
auto const &workspace = rule["workspaceString"].asString();
auto const &workspace = rule.isMember("defaultName") ? rule["defaultName"].asString()
: rule["workspaceString"].asString();
auto const &monitor = rule["monitor"].asString();
// create this workspace persistently if:
// 1. the allOutputs config option is enabled
Expand Down Expand Up @@ -375,7 +376,10 @@ void Workspaces::onWorkspaceCreated(std::string const &workspaceName,
if ((allOutputs() || m_bar.output->name == workspaceJson["monitor"].asString()) &&
(showSpecial() || !name.starts_with("special")) && !isDoubleSpecial(workspaceName)) {
for (Json::Value const &rule : workspaceRules) {
if (rule["workspaceString"].asString() == workspaceName) {
auto ruleWorkspaceName = rule.isMember("defaultName")
? rule["defaultName"].asString()
: rule["workspaceString"].asString();
if (ruleWorkspaceName == workspaceName) {
workspaceJson["persistent-rule"] = rule["persistent"].asBool();
break;
}
Expand Down

0 comments on commit d3c7ff6

Please sign in to comment.