diff --git a/app/dockcorona.cpp b/app/dockcorona.cpp index 4c502273a..97890d2fa 100644 --- a/app/dockcorona.cpp +++ b/app/dockcorona.cpp @@ -221,6 +221,15 @@ void DockCorona::load() } m_layoutManager->loadLayoutOnStartup(loadLayoutName); + + + //! load screens signals such screenGeometryChanged in order to support + //! plasmoid.screenGeometry properly + for (QScreen *screen : qGuiApp->screens()) { + addOutput(screen); + } + + connect(qGuiApp, &QGuiApplication::screenAdded, this, &DockCorona::addOutput, Qt::UniqueConnection); } } @@ -608,6 +617,19 @@ void DockCorona::addOutput(QScreen *screen) int newId = m_screenPool->firstAvailableId(); m_screenPool->insertScreenMapping(newId, screen->name()); } + + connect(screen, &QScreen::geometryChanged, this, [ = ]() { + const int id = m_screenPool->id(screen->name()); + + if (id >= 0) { + emit screenGeometryChanged(id); + emit availableScreenRegionChanged(); + emit availableScreenRectChanged(); + } + }); + + emit availableScreenRectChanged(); + emit screenAdded(m_screenPool->id(screen->name())); } void DockCorona::primaryOutputChanged() diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index ca2245113..0ba65d0fc 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -659,7 +659,7 @@ Item { id: tasksModel virtualDesktop: virtualDesktopInfo.currentDesktop - screenGeometry: latteDock ? latteDock.screenGeometry : plasmoid.screenGeometry + screenGeometry: plasmoid.screenGeometry // comment in order to support LTS Plasma 5.8 // screen: plasmoid.screen activity: activityInfo.currentActivity