fix: launch autostart application after scaleFactor has been set
Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
parent
7d94a8b71d
commit
bbe0551ffb
@ -9,6 +9,9 @@ RefuseManualStop=no
|
||||
StartLimitBurst=3
|
||||
CollectMode=inactive-or-failed
|
||||
|
||||
Requisite=dde-session-pre.target
|
||||
After=dde-session-pre.target
|
||||
|
||||
Requisite=dde-session-initialized.target
|
||||
PartOf=dde-session-initialized.target
|
||||
Before=dde-session-initialized.target
|
||||
|
@ -97,7 +97,37 @@ void ApplicationManager1Service::initService(QDBusConnection &connection) noexce
|
||||
flag.write(sessionId, sessionId.size());
|
||||
}
|
||||
|
||||
scanAutoStart();
|
||||
constexpr auto XSettings = "org.deepin.dde.XSettings1";
|
||||
|
||||
auto *watcher =
|
||||
new QDBusServiceWatcher{XSettings, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration, this};
|
||||
|
||||
auto *sigCon = new QMetaObject::Connection{};
|
||||
|
||||
auto singleSlot = [this, watcher, sigCon]() {
|
||||
QObject::disconnect(*sigCon);
|
||||
delete sigCon;
|
||||
qDebug() << XSettings << "is registered.";
|
||||
scanAutoStart();
|
||||
watcher->deleteLater();
|
||||
};
|
||||
|
||||
*sigCon = connect(watcher, &QDBusServiceWatcher::serviceRegistered, std::move(singleSlot));
|
||||
|
||||
auto msg =
|
||||
QDBusMessage::createMethodCall("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameHasOwner");
|
||||
msg << XSettings;
|
||||
|
||||
auto reply = QDBusConnection::sessionBus().call(msg);
|
||||
if (reply.type() != QDBusMessage::ReplyMessage) {
|
||||
qWarning() << "call org.freedesktop.DBus::NameHasOwner failed, skip autostart:" << reply.errorMessage();
|
||||
// ...
|
||||
return;
|
||||
}
|
||||
|
||||
if (reply.arguments().first().toBool()) {
|
||||
singleSlot();
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationManager1Service::addInstanceToApplication(const QString &unitName, const QDBusObjectPath &systemdUnitPath)
|
||||
|
Loading…
Reference in New Issue
Block a user