Fix can't get wallpaper when logging in

https://github.com/cutefishos/core/issues/1
pull/2/head
revenmartin 5 years ago
parent 67819e6e49
commit 1194d7589e

@ -56,6 +56,11 @@ public slots:
m_power.suspend();
}
void startDesktopProcess()
{
m_processManager->startDesktopProcess();
}
private:
void initEnvironments();
void initLanguage();

@ -13,5 +13,8 @@
<method name="suspend">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="startDesktopProcess">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
</interface>
</node>

@ -57,7 +57,7 @@ ProcessManager::~ProcessManager()
void ProcessManager::start()
{
startWindowManager();
loadSystemProcess();
startDaemonProcess();
QTimer::singleShot(100, this, &ProcessManager::loadAutoStartProcess);
}
@ -97,12 +97,12 @@ void ProcessManager::startWindowManager()
m_waitLoop = nullptr;
}
void ProcessManager::loadSystemProcess()
void ProcessManager::startDesktopProcess()
{
QList<QPair<QString, QStringList>> list;
list << qMakePair(QString("cutefish-settings-daemon"), QStringList());
list << qMakePair(QString("cutefish-xembedsniproxy"), QStringList());
// When the cutefish-settings-daemon theme module is loaded, start the desktop.
// In the way, there will be no problem that desktop and launcher can't get wallpaper.
QList<QPair<QString, QStringList>> list;
// Desktop components
list << qMakePair(QString("cutefish-filemanager"), QStringList("--desktop"));
list << qMakePair(QString("cutefish-statusbar"), QStringList());
@ -117,11 +117,30 @@ void ProcessManager::loadSystemProcess()
process->start();
process->waitForStarted();
if (pair.first == "cutefish-settings-daemon") {
QThread::msleep(800);
qDebug() << "Load DE components: " << pair.first << pair.second;
// Add to map
if (process->exitCode() == 0) {
m_autoStartProcess.insert(pair.first, process);
} else {
process->deleteLater();
}
}
}
qDebug() << "Load DE components: " << pair.first << pair.second;
void ProcessManager::startDaemonProcess()
{
QList<QPair<QString, QStringList>> list;
list << qMakePair(QString("cutefish-settings-daemon"), QStringList());
list << qMakePair(QString("cutefish-xembedsniproxy"), QStringList());
for (QPair<QString, QStringList> pair : list) {
QProcess *process = new QProcess;
process->setProcessChannelMode(QProcess::ForwardedChannels);
process->setProgram(pair.first);
process->setArguments(pair.second);
process->start();
process->waitForStarted();
// Add to map
if (process->exitCode() == 0) {

@ -38,7 +38,8 @@ public:
void logout();
void startWindowManager();
void loadSystemProcess();
void startDesktopProcess();
void startDaemonProcess();
void loadAutoStartProcess();
bool nativeEventFilter(const QByteArray & eventType, void * message, long * result) override;

@ -19,6 +19,8 @@
#include "thememanager.h"
#include "themeadaptor.h"
#include <QDBusInterface>
#include <QFile>
#include <QDebug>
@ -64,6 +66,13 @@ ThemeManager::ThemeManager(QObject *parent)
// Start the DE and need to update the settings again.
initGtkConfig();
// Start desktop UI component.
QDBusInterface sessionInterface("org.cutefish.Session", "/Session", "org.cutefish.Session",
QDBusConnection::sessionBus());
if (sessionInterface.isValid()) {
sessionInterface.call("startDesktopProcess");
}
}
bool ThemeManager::isDarkMode()

Loading…
Cancel
Save