From 8e7a02e7934bc606b342055737f862c511eebba2 Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Tue, 16 Jan 2024 20:36:48 +0800 Subject: [PATCH] chore: quick dirty fix for TreeLand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 临时为 TreeLand 提供的修改。此提交后续应当回退。修改内容如下: 1. TreeLand 下默认全屏 2. 隐藏切换到窗口模式的按钮 Log: --- desktopintegration.cpp | 5 +++++ desktopintegration.h | 1 + launchercontroller.cpp | 3 +++ qml/FullscreenFrame.qml | 2 ++ 4 files changed, 11 insertions(+) diff --git a/desktopintegration.cpp b/desktopintegration.cpp index c892145d..fe4f3c15 100644 --- a/desktopintegration.cpp +++ b/desktopintegration.cpp @@ -55,6 +55,11 @@ void DesktopIntegration::launchByDesktopId(const QString &desktopId) } } +QString DesktopIntegration::environmentVariable(const QString &env) +{ + return qEnvironmentVariable(env.toStdString().c_str()); +} + bool DesktopIntegration::appIsCompulsoryForDesktop(const QString &desktopId) { if (m_compulsoryAppIdList.contains(desktopId)) return true; diff --git a/desktopintegration.h b/desktopintegration.h index 750331c2..01ec66dc 100644 --- a/desktopintegration.h +++ b/desktopintegration.h @@ -30,6 +30,7 @@ class DesktopIntegration : public QObject Q_INVOKABLE static void openShutdownScreen(); Q_INVOKABLE static void openSystemSettings(); Q_INVOKABLE static void launchByDesktopId(const QString & desktopId); + Q_INVOKABLE static QString environmentVariable(const QString & env); Q_INVOKABLE bool appIsCompulsoryForDesktop(const QString & desktopId); // TODO: async get wallpaper? diff --git a/launchercontroller.cpp b/launchercontroller.cpp index 52e9bf86..f9eee3fb 100644 --- a/launchercontroller.cpp +++ b/launchercontroller.cpp @@ -28,6 +28,9 @@ LauncherController::LauncherController(QObject *parent) QSettings settings(settingPath, QSettings::NativeFormat); m_currentFrame = settings.value("current_frame", "WindowedFrame").toString(); + if (qgetenv("DDE_CURRENT_COMPOSITER") == "TreeLand") { + m_currentFrame = QStringLiteral("FullscreenFrame"); + } m_timer->setInterval(500); m_timer->setSingleShot(true); diff --git a/qml/FullscreenFrame.qml b/qml/FullscreenFrame.qml index 12e0e48f..c510bf57 100644 --- a/qml/FullscreenFrame.qml +++ b/qml/FullscreenFrame.qml @@ -119,6 +119,8 @@ Control { ToolButton { id: exitFullscreenBtn + visible: (DesktopIntegration.environmentVariable("DDE_CURRENT_COMPOSITER") !== "TreeLand") + Accessible.name: "Exit fullscreen" anchors.right: fullscreenHeader.right