Skip to content

Commit

Permalink
feat: Support for treeland
Browse files Browse the repository at this point in the history
Disabled background with treeland.
Only Showing desktop on primary screen.
Launch treeland-wallpaper to set wallpaper.

Log: 

Task: https://pms.uniontech.com/task-view-305145.html
  • Loading branch information
Clauszy committed Jan 8, 2024
1 parent fc76485 commit 0bf8a5a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
14 changes: 11 additions & 3 deletions src/apps/dde-desktop/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ static bool pluginsLoad()
"dfmplugin-filepreview" };

QStringList blackNames { DConfigManager::instance()->value(kPluginsDConfName, "desktop.blackList").toStringList() };
#ifdef COMPILE_ON_V23
if (qEnvironmentVariable("DDE_CURRENT_COMPOSITER") == "TreeLand") {
qCInfo(logAppDesktop) << "disable background by TreeLand";
if (!blackNames.contains("ddplugin-background")) {
blackNames.append("ddplugin-background");
}
}
#endif
DPF_NAMESPACE::LifeCycle::initialize({ kDesktopPluginInterface, kCommonPluginInterface }, pluginsDirs, blackNames, kLazyLoadPluginNames);

qCInfo(logAppDesktop) << "Depend library paths:" << DApplication::libraryPaths();
Expand Down Expand Up @@ -245,9 +253,6 @@ int main(int argc, char *argv[])
qCCritical(logAppDesktop) << "registerObject Failed" << conn.lastError();
exit(0x0003);
}

// Notify dde-desktop start up
registerDDESession();
}

if (isDesktopEnable()) {
Expand All @@ -267,6 +272,9 @@ int main(int argc, char *argv[])
DFMGLOBAL_NAMESPACE::DataPersistence::kDesktopStartUpReportKey,
startUpData);

// Notify dde-desktop start up
registerDDESession();

int ret { a.exec() };
DPF_NAMESPACE::LifeCycle::shutdownPlugins();
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ qreal ScreenProxyQt::devicePixelRatio() const

DisplayMode ScreenProxyQt::displayMode() const
{
#ifdef COMPILE_ON_V23
if (qEnvironmentVariable("DDE_CURRENT_COMPOSITER") == "TreeLand") {
return DisplayMode::kShowonly;
}
#endif

QList<ScreenPointer> allScreen = screens();
if (allScreen.isEmpty())
return DisplayMode::kCustom;
Expand Down
21 changes: 19 additions & 2 deletions src/plugins/desktop/ddplugin-wallpapersetting/wlsetplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "desktoputils/ddpugin_eventinterface_helper.h"

#include <dfm-base/utils/universalutils.h>

#include <QProcess>
#else
#include <QDBusMessage>
#include <QDBusPendingCall>
Expand Down Expand Up @@ -87,15 +89,30 @@ bool EventHandle::init()
}

#ifndef COMPILE_ON_V20
void EventHandle::startTreeland()
{
fmInfo() << "call treeland-wallpaper";
QProcess::startDetached("/usr/libexec/treeland-wallpaper");
}

bool EventHandle::wallpaperSetting(const QString &name)
{
show(name, (int)WallpaperSettings::Mode::WallpaperMode);
if (qEnvironmentVariable("DDE_CURRENT_COMPOSITER") == "TreeLand") {
startTreeland();
} else {
show(name, (int)WallpaperSettings::Mode::WallpaperMode);
}

return true;
}

bool EventHandle::screenSaverSetting(const QString &name)
{
show(name, (int)WallpaperSettings::Mode::ScreenSaverMode);
if (qEnvironmentVariable("DDE_CURRENT_COMPOSITER") == "TreeLand") {
startTreeland();
} else {
show(name, (int)WallpaperSettings::Mode::ScreenSaverMode);
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public slots:
protected:
void onChanged();
void show(QString name, int mode);

void startTreeland();
private:
WallpaperSettings *wallpaperSettings = nullptr;
#endif
Expand Down

0 comments on commit 0bf8a5a

Please sign in to comment.