diff --git a/kded/osd.cpp b/kded/osd.cpp --- a/kded/osd.cpp +++ b/kded/osd.cpp @@ -25,10 +25,13 @@ #include -#include +#include +#include +#include #include +#include + #include -#include using namespace KScreen; @@ -138,6 +141,10 @@ this, SLOT(onOsdActionSelected(int))); } if (auto *rootObject = m_osdActionSelector->rootObject()) { + // On wayland, we use m_output to set an action on OSD position + if (qGuiApp->platformName() == QLatin1String("wayland")) { + rootObject->setProperty("screenGeometry", m_output->geometry()); + } rootObject->setProperty("visible", true); } else { qCWarning(KSCREEN_KDED) << "Could not get root object for action selector."; diff --git a/kded/qml/OsdSelector.qml b/kded/qml/OsdSelector.qml --- a/kded/qml/OsdSelector.qml +++ b/kded/qml/OsdSelector.qml @@ -29,6 +29,12 @@ location: PlasmaCore.Types.Floating type: PlasmaCore.Dialog.Normal property string infoText + property var screenGeometry + + onScreenGeometryChanged: { + root.x = screenGeometry.x + (screenGeometry.width - mainItem.width) / 2 + root.y = screenGeometry.y + (screenGeometry.height - mainItem.height) / 2 + } signal clicked(int actionId)