Skip to content

Commit d3c7ff6

Browse files
authored
Merge pull request #3947 from zjeffer/fix/zjeffer/workspacerules-defaultname
Fix workspacerules not taking into account defaultName
2 parents c32d5e3 + bcee548 commit d3c7ff6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/modules/hyprland/workspaces.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ void Workspaces::loadPersistentWorkspacesFromWorkspaceRules(const Json::Value &c
294294
if (!rule["persistent"].asBool()) {
295295
continue;
296296
}
297-
auto const &workspace = rule["workspaceString"].asString();
297+
auto const &workspace = rule.isMember("defaultName") ? rule["defaultName"].asString()
298+
: rule["workspaceString"].asString();
298299
auto const &monitor = rule["monitor"].asString();
299300
// create this workspace persistently if:
300301
// 1. the allOutputs config option is enabled
@@ -375,7 +376,10 @@ void Workspaces::onWorkspaceCreated(std::string const &workspaceName,
375376
if ((allOutputs() || m_bar.output->name == workspaceJson["monitor"].asString()) &&
376377
(showSpecial() || !name.starts_with("special")) && !isDoubleSpecial(workspaceName)) {
377378
for (Json::Value const &rule : workspaceRules) {
378-
if (rule["workspaceString"].asString() == workspaceName) {
379+
auto ruleWorkspaceName = rule.isMember("defaultName")
380+
? rule["defaultName"].asString()
381+
: rule["workspaceString"].asString();
382+
if (ruleWorkspaceName == workspaceName) {
379383
workspaceJson["persistent-rule"] = rule["persistent"].asBool();
380384
break;
381385
}

0 commit comments

Comments
 (0)