1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Add alternate ways if checking for Steam Deck

This commit is contained in:
Joshua Goins 2023-12-20 17:08:55 -05:00
parent 83428c762e
commit 123d0ea6f7
2 changed files with 14 additions and 11 deletions

View file

@ -210,7 +210,7 @@ bool LauncherCore::isSteam() const
bool LauncherCore::isSteamDeck() const bool LauncherCore::isSteamDeck() const
{ {
if (m_steamApi != nullptr) { if (m_steamApi != nullptr) {
return m_steamApi->isDeck(); return m_steamApi->isDeck() || qEnvironmentVariable("XDG_CURRENT_DESKTOP") == QStringLiteral("gamescope");
} else { } else {
return false; return false;
} }

View file

@ -30,11 +30,6 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
// Default to org.kde.desktop style unless the user forces another style
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
}
// Default to a sensible message pattern // Default to a sensible message pattern
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) { if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
qputenv("QT_MESSAGE_PATTERN", "[%{time yyyy-MM-dd h:mm:ss.zzz}] %{if-category}[%{category}] %{endif}[%{type}] %{message}"); qputenv("QT_MESSAGE_PATTERN", "[%{time yyyy-MM-dd h:mm:ss.zzz}] %{if-category}[%{category}] %{endif}[%{type}] %{message}");
@ -91,6 +86,7 @@ int main(int argc, char *argv[])
parser.showVersion(); parser.showVersion();
} }
bool isSteamDeck = false;
if (parser.isSet(steamOption)) { if (parser.isSet(steamOption)) {
const QStringList args = parser.positionalArguments(); const QStringList args = parser.positionalArguments();
// Steam tries to use as a compatibility tool, running installation scripts (like DirectX), so try to ignore it. // Steam tries to use as a compatibility tool, running installation scripts (like DirectX), so try to ignore it.
@ -98,11 +94,18 @@ int main(int argc, char *argv[])
return 0; return 0;
} }
#ifndef ENABLE_STEAM if (qEnvironmentVariable("XDG_CURRENT_DESKTOP") == QStringLiteral("gamescope")) {
QMessageBox::warning(nullptr, isSteamDeck = true;
i18n("Warning"), }
i18n("You somehow launched Astra through Steam, despite it not being compiled with Steam support. Some features may not work!")); }
#endif
// Default to org.kde.desktop style unless the user forces another style
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
if (isSteamDeck) {
QQuickStyle::setStyle(QStringLiteral("org.kde.breeze"));
} else {
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
}
} }
QCoro::Qml::registerTypes(); QCoro::Qml::registerTypes();