Skip to content

Commit

Permalink
fix: hide the power button in treeland
Browse files Browse the repository at this point in the history
Temporarily hide the power button in treenland

Log: hide the power button in treeland
  • Loading branch information
xionglinlin committed Nov 15, 2024
1 parent 1be2f93 commit 6fa3c9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion desktopintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <DStandardPaths>
#include <DDesktopServices>
#include <QRect>
#include <QGuiApplication>
#include <appinfo.h>
#include <appmgr.h>

Expand All @@ -28,7 +29,7 @@ QString DesktopIntegration::currentDE()

bool DesktopIntegration::isTreeLand()
{
return qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == QStringLiteral("TreeLand");
return QGuiApplication::platformName() == "wayland";
}

void DesktopIntegration::openShutdownScreen()
Expand Down
4 changes: 1 addition & 3 deletions launchercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <DGuiApplicationHelper>
#include <QCommandLineParser>
#include <launcher1adaptor.h>
#include "desktopintegration.h"

DGUI_USE_NAMESPACE

Expand All @@ -28,9 +29,6 @@ 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");
}

// Interval set to 500=>1000ms for issue https://github.com/linuxdeepin/developer-center/issues/8137
m_timer->setInterval(1000);
Expand Down
2 changes: 2 additions & 0 deletions qml/windowed/BottomBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Control {
ToolTip.delay: 1000
ToolTip.text: qsTr("Power")
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
// TODO: remove this when treeland is supported
visible: !DesktopIntegration.isTreeLand()
onClicked: {
DesktopIntegration.openShutdownScreen();
}
Expand Down

0 comments on commit 6fa3c9c

Please sign in to comment.