monitor: keep workspace monitor bindings on full reconnect (#13384)
When all monitors disconnect, non-active workspaces could migrate to the wrong output after reconnect. Preserve workspace ownership and re-apply assigned monitor bindings on connect.
This commit is contained in:
parent
82729db330
commit
c2bed4103c
3 changed files with 47 additions and 11 deletions
|
|
@ -3067,6 +3067,27 @@ void CCompositor::ensurePersistentWorkspacesPresent(const std::vector<SWorkspace
|
|||
}
|
||||
}
|
||||
|
||||
void CCompositor::ensureWorkspacesOnAssignedMonitors() {
|
||||
for (auto const& ws : getWorkspacesCopy()) {
|
||||
if (!valid(ws) || ws->m_isSpecialWorkspace)
|
||||
continue;
|
||||
|
||||
const auto RULE = g_pConfigManager->getWorkspaceRuleFor(ws);
|
||||
if (RULE.monitor.empty())
|
||||
continue;
|
||||
|
||||
const auto PMONITOR = getMonitorFromString(RULE.monitor);
|
||||
if (!PMONITOR)
|
||||
continue;
|
||||
|
||||
if (ws->m_monitor == PMONITOR)
|
||||
continue;
|
||||
|
||||
Log::logger->log(Log::DEBUG, "ensureWorkspacesOnAssignedMonitors: moving workspace {} to {}", ws->m_name, PMONITOR->m_name);
|
||||
moveWorkspaceToMonitor(ws, PMONITOR, true);
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<unsigned int> CCompositor::getVTNr() {
|
||||
if (!m_aqBackend->hasSession())
|
||||
return std::nullopt;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue