diff options
Diffstat (limited to 'src/platformsupport')
-rw-r--r-- | src/platformsupport/services/genericunix/qgenericunixservices.cpp | 4 | ||||
-rw-r--r-- | src/platformsupport/themes/genericunix/qgenericunixthemes.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/src/platformsupport/services/genericunix/qgenericunixservices.cpp index f6bf8608d1..7d0145e61d 100644 --- a/src/platformsupport/services/genericunix/qgenericunixservices.cpp +++ b/src/platformsupport/services/genericunix/qgenericunixservices.cpp @@ -56,6 +56,10 @@ static inline QByteArray detectDesktopEnvironment() { if (!qEnvironmentVariableIsEmpty("KDE_FULL_SESSION")) return QByteArray("KDE"); + // Check Unity first, whose older versions also have "GNOME_DESKTOP_SESSION_ID" set. + const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP"); + if (xdgCurrentDesktop == "Unity") + return QByteArrayLiteral("UNITY"); // GNOME_DESKTOP_SESSION_ID is deprecated for some reason, but still check it if (qgetenv("DESKTOP_SESSION") == "gnome" || !qEnvironmentVariableIsEmpty("GNOME_DESKTOP_SESSION_ID")) return QByteArray("GNOME"); diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index a39f26efc8..d773bc8c8e 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -420,11 +420,12 @@ QStringList QGenericUnixTheme::themeNames() { QStringList result; if (QGuiApplication::desktopSettingsAware()) { - if (QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment() == QByteArray("KDE")) { + const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); + if (desktopEnvironment == QByteArrayLiteral("KDE")) { #ifndef QT_NO_SETTINGS result.push_back(QLatin1String(QKdeTheme::name)); #endif - } else if (QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment() == QByteArray("GNOME")) { + } else { // Gnome, Unity, other Gtk-based desktops like XFCE. result.push_back(QLatin1String(QGnomeTheme::name)); } const QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION")); |