@@ -227,11 +227,14 @@ private Q_SLOTS:
227227 {
228228 if (!active) {
229229 setupSystemdInhibition();
230+ } else {
231+ Q_EMIT prepareForSleep();
230232 }
231233 }
232234
233235Q_SIGNALS:
234236 void screensaverActiveChanged(bool active);
237+ void prepareForSleep();
235238};
236239
237240Q_GLOBAL_STATIC(DBusUnitySessionServicePrivate, d)
@@ -245,6 +248,7 @@ DBusUnitySessionService::DBusUnitySessionService()
245248 // ... and our Unlocked() signal to the logind's session Unlock() signal
246249 // (lightdm handles the unlocking by calling logind's Unlock method which in turn emits this signal we connect to)
247250 QDBusConnection::systemBus().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Unlock"), this, SIGNAL(Unlocked()));
251+ connect(d, &DBusUnitySessionServicePrivate::prepareForSleep, this, &DBusUnitySessionService::PromptLock);
248252 } else {
249253 qWarning() << "Failed to connect to logind's session Lock/Unlock signals";
250254 }