Skip to content

Commit

Permalink
chore: quick dirty fix for TreeLand
Browse files Browse the repository at this point in the history
临时为 TreeLand 提供的修改。此提交后续应当回退。修改内容如下:

1. TreeLand 下默认全屏
2. 隐藏切换到窗口模式的按钮

Log:
  • Loading branch information
BLumia committed Jan 18, 2024
1 parent db845bf commit 9b503b6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions desktopintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions desktopintegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
3 changes: 3 additions & 0 deletions launchercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_COMPOSITOR") == "TreeLand") {
m_currentFrame = QStringLiteral("FullscreenFrame");
}

m_timer->setInterval(500);
m_timer->setSingleShot(true);
Expand Down
2 changes: 2 additions & 0 deletions qml/FullscreenFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ Control {
ToolButton {
id: exitFullscreenBtn

visible: (DesktopIntegration.environmentVariable("DDE_CURRENT_COMPOSITOR") !== "TreeLand")

Accessible.name: "Exit fullscreen"

anchors.right: fullscreenHeader.right
Expand Down
6 changes: 5 additions & 1 deletion qml/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ QtObject {
// root.visibility = Window.FullScreen
// Fullscreen mode: always assume dark theme
ApplicationHelper.setPaletteType(ApplicationHelper.DarkType)
fullscreenFrame.setGeometry(Screen.virtualX, Screen.virtualY, Screen.width, Screen.height)
if (DesktopIntegration.environmentVariable("DDE_CURRENT_COMPOSITOR") !== "TreeLand") {
fullscreenFrame.setGeometry(Screen.virtualX, Screen.virtualY, Screen.width, Screen.height)
} else {
fullscreenFrame.showFullScreen()
}
fullscreenFrame.requestActivate()
}
}
Expand Down

0 comments on commit 9b503b6

Please sign in to comment.