mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 16:06:00 +01:00
workspaces: restore monitor on re-plug
This commit is contained in:
parent
0155b85950
commit
fd3e6a3bfd
2 changed files with 14 additions and 1 deletions
|
@ -144,6 +144,14 @@ void CMonitor::onConnect(bool noRule) {
|
||||||
|
|
||||||
setupDefaultWS(monitorRule);
|
setupDefaultWS(monitorRule);
|
||||||
|
|
||||||
|
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
||||||
|
if (ws->m_szLastMonitor == szName) {
|
||||||
|
g_pCompositor->moveWorkspaceToMonitor(ws.get(), this);
|
||||||
|
ws->startAnim(true, true, true);
|
||||||
|
ws->m_szLastMonitor = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scale = monitorRule.scale;
|
scale = monitorRule.scale;
|
||||||
if (scale < 0.1)
|
if (scale < 0.1)
|
||||||
scale = getDefaultScale();
|
scale = getDefaultScale();
|
||||||
|
@ -264,6 +272,7 @@ void CMonitor::onDisconnect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& w : wspToMove) {
|
for (auto& w : wspToMove) {
|
||||||
|
w->m_szLastMonitor = szName;
|
||||||
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
|
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
|
||||||
w->startAnim(true, true, true);
|
w->startAnim(true, true, true);
|
||||||
}
|
}
|
||||||
|
@ -378,6 +387,7 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) {
|
||||||
|
|
||||||
g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle);
|
g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle);
|
||||||
PNEWWORKSPACE->setActive(true);
|
PNEWWORKSPACE->setActive(true);
|
||||||
|
PNEWWORKSPACE->m_szLastMonitor = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMonitor::setMirror(const std::string& mirrorOf) {
|
void CMonitor::setMirror(const std::string& mirrorOf) {
|
||||||
|
|
|
@ -51,7 +51,10 @@ class CWorkspace {
|
||||||
bool m_bDefaultPseudo = false;
|
bool m_bDefaultPseudo = false;
|
||||||
|
|
||||||
// don't destroy in sanity check
|
// don't destroy in sanity check
|
||||||
bool m_bIndestructible = false;
|
bool m_bIndestructible = false;
|
||||||
|
|
||||||
|
// last monitor (used on reconnect)
|
||||||
|
std::string m_szLastMonitor = "";
|
||||||
|
|
||||||
void startAnim(bool in, bool left, bool instant = false);
|
void startAnim(bool in, bool left, bool instant = false);
|
||||||
void setActive(bool on);
|
void setActive(bool on);
|
||||||
|
|
Loading…
Reference in a new issue