linux-desktop-environment: detect Ubuntu properly enabling features

In Ubuntu (running in GNOME) we support AppIndicator and
Unity counters still.
This commit is contained in:
Marco Trevisan (Treviño) 2018-02-08 20:43:29 +01:00 committed by John Preston
parent 9dc3847dbe
commit 0de9c62675
2 changed files with 11 additions and 2 deletions

View File

@ -38,6 +38,9 @@ Type Compute() {
} else if (list.contains("pantheon")) { } else if (list.contains("pantheon")) {
return Type::Pantheon; return Type::Pantheon;
} else if (list.contains("gnome")) { } else if (list.contains("gnome")) {
if (list.contains("ubuntu"))
return Type::Ubuntu;
return Type::Gnome; return Type::Gnome;
} else if (list.contains("kde")) { } else if (list.contains("kde")) {
if (kdeSession == qstr("5")) { if (kdeSession == qstr("5")) {
@ -88,6 +91,7 @@ Type ComputeAndLog() {
case Type::KDE3: return "KDE3"; case Type::KDE3: return "KDE3";
case Type::KDE4: return "KDE4"; case Type::KDE4: return "KDE4";
case Type::KDE5: return "KDE5"; case Type::KDE5: return "KDE5";
case Type::Ubuntu: return "Ubuntu";
case Type::Unity: return "Unity"; case Type::Unity: return "Unity";
case Type::XFCE: return "XFCE"; case Type::XFCE: return "XFCE";
case Type::Pantheon: return "Pantheon"; case Type::Pantheon: return "Pantheon";
@ -112,12 +116,12 @@ bool TryQtTrayIcon() {
} }
bool PreferAppIndicatorTrayIcon() { bool PreferAppIndicatorTrayIcon() {
return IsXFCE() || IsUnity() || return IsXFCE() || IsUnity() || IsUbuntu() ||
(IsGnome() && QDBusInterface("org.kde.StatusNotifierWatcher", "/").isValid()); (IsGnome() && QDBusInterface("org.kde.StatusNotifierWatcher", "/").isValid());
} }
bool TryUnityCounter() { bool TryUnityCounter() {
return IsUnity() || IsPantheon(); return IsUnity() || IsPantheon() || IsUbuntu();
} }
} // namespace DesktopEnvironment } // namespace DesktopEnvironment

View File

@ -16,6 +16,7 @@ enum class Type {
KDE3, KDE3,
KDE4, KDE4,
KDE5, KDE5,
Ubuntu,
Unity, Unity,
XFCE, XFCE,
Pantheon, Pantheon,
@ -44,6 +45,10 @@ inline bool IsKDE() {
return IsKDE3() || IsKDE4() || IsKDE5(); return IsKDE3() || IsKDE4() || IsKDE5();
} }
inline bool IsUbuntu() {
return Get() == Type::Ubuntu;
}
inline bool IsUnity() { inline bool IsUnity() {
return Get() == Type::Unity; return Get() == Type::Unity;
} }