mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-20 04:10:04 +01:00
internal: Ensure unique identifiers for persistent workspaces (#11409)
This commit is contained in:
parent
2b6e2ceb2e
commit
aa6a78f0a4
2 changed files with 11 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ static bool test() {
|
|||
OK(getFromSocket("/keyword workspace 5, monitor:HEADLESS-2, persistent:1"));
|
||||
OK(getFromSocket("/keyword workspace 6, monitor:HEADLESS-PERSISTENT-TEST, persistent:1"));
|
||||
OK(getFromSocket("/keyword workspace name:PERSIST, monitor:HEADLESS-PERSISTENT-TEST, persistent:1"));
|
||||
OK(getFromSocket("/keyword workspace name:PERSIST-2, monitor:HEADLESS-PERSISTENT-TEST, persistent:1"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/workspaces");
|
||||
|
|
@ -52,7 +53,8 @@ static bool test() {
|
|||
EXPECT_CONTAINS(str, "ID 5 (5)");
|
||||
EXPECT_CONTAINS(str, "ID 6 (6)");
|
||||
EXPECT_CONTAINS(str, "(PERSIST) on monitor");
|
||||
EXPECT_COUNT_STRING(str, "workspace ID ", 5);
|
||||
EXPECT_CONTAINS(str, "(PERSIST-2) on monitor");
|
||||
EXPECT_COUNT_STRING(str, "workspace ID ", 6);
|
||||
}
|
||||
|
||||
OK(getFromSocket("/reload"));
|
||||
|
|
|
|||
|
|
@ -1727,6 +1727,14 @@ WORKSPACEID CCompositor::getNextAvailableNamedWorkspace() {
|
|||
lowest = w->m_id;
|
||||
}
|
||||
|
||||
// Give priority to persistent workspaces to avoid any conflicts between them.
|
||||
for (auto const& rule : g_pConfigManager->getAllWorkspaceRules()) {
|
||||
if (!rule.isPersistent)
|
||||
continue;
|
||||
if (rule.workspaceId < -1 && rule.workspaceId < lowest)
|
||||
lowest = rule.workspaceId;
|
||||
}
|
||||
|
||||
return lowest - 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue