diff --git a/src/workspace.cpp b/src/workspace.cpp index e982a6a485..9d459c4a8e 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -177,25 +177,6 @@ void Workspace::init() connect(options, &Options::separateScreenFocusChanged, m_focusChain.get(), &FocusChain::setSeparateScreenFocus); m_focusChain->setSeparateScreenFocus(options->isSeparateScreenFocus()); - if (waylandServer()) { - m_outputConfigStore = std::make_unique(); - - const auto applySensorChanges = [this]() { - m_orientationSensor->setEnabled(m_outputConfigStore->isAutoRotateActive(kwinApp()->outputBackend()->outputs(), kwinApp()->tabletModeManager()->effectiveTabletMode())); - const auto opt = m_outputConfigStore->queryConfig(kwinApp()->outputBackend()->outputs(), m_lidSwitchTracker->isLidClosed(), m_orientationSensor->reading(), kwinApp()->tabletModeManager()->effectiveTabletMode()); - if (opt) { - const auto &[config, order, type] = *opt; - applyOutputConfiguration(config, order); - } - }; - connect(m_lidSwitchTracker.get(), &LidSwitchTracker::lidStateChanged, this, applySensorChanges); - connect(m_orientationSensor.get(), &OrientationSensor::orientationChanged, this, applySensorChanges); - connect(kwinApp()->tabletModeManager(), &TabletModeManager::tabletModeChanged, this, applySensorChanges); - m_orientationSensor->setEnabled(m_outputConfigStore->isAutoRotateActive(kwinApp()->outputBackend()->outputs(), kwinApp()->tabletModeManager()->effectiveTabletMode())); - } - slotOutputBackendOutputsQueried(); - connect(kwinApp()->outputBackend(), &OutputBackend::outputsQueried, this, &Workspace::slotOutputBackendOutputsQueried); - // create VirtualDesktopManager and perform dependency injection VirtualDesktopManager *vds = VirtualDesktopManager::self(); connect(vds, &VirtualDesktopManager::desktopAdded, this, &Workspace::slotDesktopAdded); @@ -216,9 +197,28 @@ void Workspace::init() // makes sure any autogenerated id is saved, necessary as in case of xwayland, load will be called 2 times // load is needed to be called again when starting xwayalnd to sync to RootInfo, see BUG 385260 vds->save(); - vds->setCurrent(m_initialDesktop); + if (waylandServer()) { + m_outputConfigStore = std::make_unique(); + + const auto applySensorChanges = [this]() { + m_orientationSensor->setEnabled(m_outputConfigStore->isAutoRotateActive(kwinApp()->outputBackend()->outputs(), kwinApp()->tabletModeManager()->effectiveTabletMode())); + const auto opt = m_outputConfigStore->queryConfig(kwinApp()->outputBackend()->outputs(), m_lidSwitchTracker->isLidClosed(), m_orientationSensor->reading(), kwinApp()->tabletModeManager()->effectiveTabletMode()); + if (opt) { + const auto &[config, order, type] = *opt; + applyOutputConfiguration(config, order); + } + }; + connect(m_lidSwitchTracker.get(), &LidSwitchTracker::lidStateChanged, this, applySensorChanges); + connect(m_orientationSensor.get(), &OrientationSensor::orientationChanged, this, applySensorChanges); + connect(kwinApp()->tabletModeManager(), &TabletModeManager::tabletModeChanged, this, applySensorChanges); + m_orientationSensor->setEnabled(m_outputConfigStore->isAutoRotateActive(kwinApp()->outputBackend()->outputs(), kwinApp()->tabletModeManager()->effectiveTabletMode())); + } + + slotOutputBackendOutputsQueried(); + connect(kwinApp()->outputBackend(), &OutputBackend::outputsQueried, this, &Workspace::slotOutputBackendOutputsQueried); + reconfigureTimer.setSingleShot(true); m_rearrangeTimer.setSingleShot(true);