mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-20 14:33:47 -07:00
internal: Ensure unique identifiers for persistent workspaces (#11409)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user