2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-10-25 14:58:42 +00:00

Rework DE detection

Variables can point to a mixed environment, make DE detection non-exclusive.
Remove unused methods.
This commit is contained in:
Ilya Fedin
2022-01-06 23:24:21 +04:00
committed by John Preston
parent ba6c3eaf73
commit 726aa3316d
3 changed files with 76 additions and 123 deletions

View File

@@ -11,67 +11,33 @@ namespace Platform {
namespace DesktopEnvironment {
enum class Type {
Other,
Gnome,
Cinnamon,
KDE3,
KDE4,
KDE5,
KDE,
Unity,
XFCE,
MATE,
LXDE,
};
Type Get();
std::vector<Type> Get();
inline bool IsGnome() {
return Get() == Type::Gnome;
return ranges::contains(Get(), Type::Gnome);
}
inline bool IsCinnamon() {
return Get() == Type::Cinnamon;
}
inline bool IsKDE3() {
return Get() == Type::KDE3;
}
inline bool IsKDE4() {
return Get() == Type::KDE4;
}
inline bool IsKDE5() {
return Get() == Type::KDE5;
return ranges::contains(Get(), Type::Cinnamon);
}
inline bool IsKDE() {
return IsKDE3() || IsKDE4() || IsKDE5();
return ranges::contains(Get(), Type::KDE);
}
inline bool IsUnity() {
return Get() == Type::Unity;
}
inline bool IsXFCE() {
return Get() == Type::XFCE;
return ranges::contains(Get(), Type::Unity);
}
inline bool IsMATE() {
return Get() == Type::MATE;
}
inline bool IsLXDE() {
return Get() == Type::LXDE;
}
inline bool IsGtkBased() {
return IsGnome()
|| IsCinnamon()
|| IsUnity()
|| IsMATE()
|| IsXFCE()
|| IsLXDE();
return ranges::contains(Get(), Type::MATE);
}
} // namespace DesktopEnvironment