Commit 01e1ab30 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Allow an OSD to stay on screen forever (when it requires action)

parent 5b17c9e3
......@@ -49,7 +49,6 @@ Osd::Osd(const KScreen::OutputPtr output, QObject *parent)
}
m_timeout = m_osdObject->rootObject()->property("timeout").toInt();
m_osdTimer = new QTimer(this);
m_osdTimer->setSingleShot(true);
connect(m_osdTimer, &QTimer::timeout, this, &Osd::hideOsd);
......@@ -114,16 +113,22 @@ void Osd::showOsd()
// only animate on X11, wayland plugin doesn't support this and
// pukes loads of warnings into our logs
if (qGuiApp->platformName() == QLatin1String("xcb")) {
rootObject->setProperty("animateOpacity", false);
rootObject->setProperty("opacity", 1);
rootObject->setProperty("visible", true);
rootObject->setProperty("animateOpacity", true);
rootObject->setProperty("opacity", 0);
if (rootObject->property("timeout").toInt() > 0) {
rootObject->setProperty("animateOpacity", false);
rootObject->setProperty("opacity", 1);
rootObject->setProperty("visible", true);
rootObject->setProperty("animateOpacity", true);
rootObject->setProperty("opacity", 0);
} else {
rootObject->setProperty("visible", true);
}
} else {
rootObject->setProperty("visible", true);
}
updatePosition();
m_osdTimer->start(m_timeout);
if (m_timeout > 0) {
m_osdTimer->start(m_timeout);
}
}
void Osd::hideOsd()
......
......@@ -47,7 +47,7 @@ PlasmaCore.Dialog {
easing.type: Easing.InQuad
}
}
enabled: root.animateOpacity
enabled: root.timeout > 0 && root.animateOpacity
}
mainItem: Loader {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment