Simpler desktop detection code
This commit is contained in:
@@ -26,25 +26,21 @@ DesktopInfo::DesktopInfo()
|
||||
WAYLAND_DISPLAY = e.value("WAYLAND_DISPLAY");
|
||||
KDE_FULL_SESSION = e.value("KDE_FULL_SESSION");
|
||||
GNOME_DESKTOP_SESSION_ID = e.value("GNOME_DESKTOP_SESSION_ID");
|
||||
GDMSESSION = e.value("GDMSESSION");
|
||||
DESKTOP_SESSION = e.value("DESKTOP_SESSION");
|
||||
}
|
||||
|
||||
bool DesktopInfo::waylandDectected() {
|
||||
return XDG_SESSION_TYPE == "wayland" || WAYLAND_DISPLAY.contains("wayland");
|
||||
return XDG_SESSION_TYPE == "wayland" ||
|
||||
WAYLAND_DISPLAY.contains("wayland", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
DesktopInfo::WM DesktopInfo::windowManager() {
|
||||
DesktopInfo::WM res = DesktopInfo::OTHER;
|
||||
if (XDG_CURRENT_DESKTOP.contains("GNOME", Qt::CaseInsensitive) ||
|
||||
!GNOME_DESKTOP_SESSION_ID.isEmpty() ||
|
||||
QString::compare("GNOME", GDMSESSION, Qt::CaseInsensitive) == 0 ||
|
||||
GDMSESSION == "gnome-shell" ||
|
||||
GDMSESSION == "gnome-classic" ||
|
||||
GDMSESSION == "gnome-fallback")
|
||||
!GNOME_DESKTOP_SESSION_ID.isEmpty())
|
||||
{
|
||||
res = DesktopInfo::GNOME;
|
||||
} else if (KDE_FULL_SESSION == "true" || DESKTOP_SESSION == "kde-plasma") {
|
||||
} else if (!KDE_FULL_SESSION.isEmpty() || DESKTOP_SESSION == "kde-plasma") {
|
||||
res = DesktopInfo::KDE;
|
||||
}
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user