Repository: hyprwm/Hyprland
File: src/Compositor.cpp (C++)

Code before:
        return SImageDescription{};
    }
    Debug::log(WARN, "FIXME: color management protocol is enabled, determine correct preferred image description");
    // should determine some common settings to avoid unnecessary transformations while keeping maximum displayable precision
    return SImageDescription{.primaries = NColorPrimaries::BT709};
}

bool CCompositor::shouldChangePreferredImageDescription() {
    Debug::log(WARN, "FIXME: color management protocol is enabled and outputs changed, check preferred image description changes");
    return false;
}

void CCompositor::ensurePersistentWorkspacesPresent(const std::vector<SWorkspaceRule>& rules, PHLWORKSPACE pWorkspace) {

    for (const auto& rule : rules) {
        if (!rule.isPersistent)
            continue;

        const auto PMONITOR = getMonitorFromString(rule.monitor);

        if (!PMONITOR) {
            Debug::log(ERR, "ensurePersistentWorkspacesPresent: couldn't resolve monitor for {}, skipping", rule.monitor);
            continue;
        }

        auto PWORKSPACE = pWorkspace;

        if (!PWORKSPACE) {
            WORKSPACEID id     = rule.workspaceId;
            std::string wsname = rule.workspaceName;

            if (id == WORKSPACE_INVALID) {
                const auto R = getWorkspaceIDNameFromString(rule.workspaceString);
                id           = R.id;
                wsname       = R.name;
            }

            if (id == WORKSPACE_INVALID) {
                Debug::log(ERR, "ensurePersistentWorkspacesPresent: couldn't resolve id for workspace {}", rule.workspaceString);
                continue;
            }
            PWORKSPACE = getWorkspaceByID(id);
            if (!PWORKSPACE)
                createNewWorkspace(id, PMONITOR ? PMONITOR : m_pLastMonitor.lock(), wsname, false);
        }
        if (PWORKSPACE) {
            PWORKSPACE->m_bPersistent = true;

            if (PWORKSPACE->m_pMonitor == PMONITOR) {
                Debug::log(LOG, "ensurePersistentWorkspacesPresent: workspace persistent {} already on {}", rule.workspaceString, PMONITOR->szName);


Review comment (suggestion):
I don't think this is correct?

Let's say we want to recheck Workspace `1`, so pWorkspace is `1`

Then, we have a rule
```
workspace = 2, persistent:1, monitor:DP-2
```

we get to this spot with our rule, but set `1`'s persistent to true...

Code after:
        return SImageDescription{};
    }
    Debug::log(WARN, "FIXME: color management protocol is enabled, determine correct preferred image description");
    // should determine some common settings to avoid unnecessary transformations while keeping maximum displayable precision
    return SImageDescription{.primaries = NColorPrimaries::BT709};
}

bool CCompositor::shouldChangePreferredImageDescription() {
    Debug::log(WARN, "FIXME: color management protocol is enabled and outputs changed, check preferred image description changes");
    return false;
}

void CCompositor::ensurePersistentWorkspacesPresent(const std::vector<SWorkspaceRule>& rules, PHLWORKSPACE pWorkspace) {

    for (const auto& rule : rules) {
        if (!rule.isPersistent)
            continue;

        PHLWORKSPACE PWORKSPACE = nullptr;
        if (pWorkspace) {
            if (pWorkspace->matchesStaticSelector(rule.workspaceString))
                PWORKSPACE = pWorkspace;
            else
                continue;
        }

        const auto PMONITOR = getMonitorFromString(rule.monitor);

        if (!PWORKSPACE) {
            WORKSPACEID id     = rule.workspaceId;
            std::string wsname = rule.workspaceName;

            if (id == WORKSPACE_INVALID) {
                const auto R = getWorkspaceIDNameFromString(rule.workspaceString);
                id           = R.id;
                wsname       = R.name;
            }

            if (id == WORKSPACE_INVALID) {
                Debug::log(ERR, "ensurePersistentWorkspacesPresent: couldn't resolve id for workspace {}", rule.workspaceString);
                continue;
            }
            PWORKSPACE = getWorkspaceByID(id);
            if (!PWORKSPACE)
                createNewWorkspace(id, PMONITOR ? PMONITOR : m_pLastMonitor.lock(), wsname, false);
        }

        if (PWORKSPACE)
            PWORKSPACE->m_bPersistent = true;

        if (!PMONITOR) {