mirror of https://github.com/procxx/kepka.git
Use appindicator in flatpak and fix desktop environment detection, add pavucontrol-qt
This commit is contained in:
parent
b94c8436eb
commit
04cfd598e2
|
@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "platform/linux/linux_desktop_environment.h"
|
||||
|
||||
#include "platform/linux/specific_linux.h"
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
#include <QDBusInterface>
|
||||
#endif
|
||||
|
@ -26,7 +28,14 @@ Type Compute() {
|
|||
auto xdgCurrentDesktop = GetEnv("XDG_CURRENT_DESKTOP").toLower();
|
||||
auto list = xdgCurrentDesktop.split(':', QString::SkipEmptyParts);
|
||||
auto desktopSession = GetEnv("DESKTOP_SESSION").toLower();
|
||||
auto slash = desktopSession.lastIndexOf('/');
|
||||
auto kdeSession = GetEnv("KDE_SESSION_VERSION");
|
||||
|
||||
// DESKTOP_SESSION can contain a path
|
||||
if (slash != -1) {
|
||||
desktopSession = desktopSession.mid(slash + 1);
|
||||
}
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
if (list.contains("unity")) {
|
||||
// gnome-fallback sessions set XDG_CURRENT_DESKTOP to Unity
|
||||
|
@ -35,8 +44,6 @@ Type Compute() {
|
|||
return Type::Gnome;
|
||||
}
|
||||
return Type::Unity;
|
||||
} else if (list.contains("xfce")) {
|
||||
return Type::XFCE;
|
||||
} else if (list.contains("pantheon")) {
|
||||
return Type::Pantheon;
|
||||
} else if (list.contains("gnome")) {
|
||||
|
@ -53,7 +60,7 @@ Type Compute() {
|
|||
}
|
||||
|
||||
if (!desktopSession.isEmpty()) {
|
||||
if (desktopSession == qstr("gnome") || desktopSession == qstr("mate")) {
|
||||
if (desktopSession == qstr("gnome")) {
|
||||
return Type::Gnome;
|
||||
} else if (desktopSession == qstr("kde4") || desktopSession == qstr("kde-plasma")) {
|
||||
return Type::KDE4;
|
||||
|
@ -63,10 +70,6 @@ Type Compute() {
|
|||
return Type::KDE4;
|
||||
}
|
||||
return Type::KDE3;
|
||||
} else if (desktopSession.indexOf(qstr("xfce")) >= 0 || desktopSession == qstr("xubuntu")) {
|
||||
return Type::XFCE;
|
||||
} else if (desktopSession == qstr("awesome")) {
|
||||
return Type::Awesome;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,9 +98,7 @@ Type ComputeAndLog() {
|
|||
case Type::KDE5: return "KDE5";
|
||||
case Type::Ubuntu: return "Ubuntu";
|
||||
case Type::Unity: return "Unity";
|
||||
case Type::XFCE: return "XFCE";
|
||||
case Type::Pantheon: return "Pantheon";
|
||||
case Type::Awesome: return "Awesome";
|
||||
}
|
||||
return QString::number(static_cast<int>(result));
|
||||
};
|
||||
|
@ -114,15 +115,17 @@ Type Get() {
|
|||
}
|
||||
|
||||
bool TryQtTrayIcon() {
|
||||
return !IsPantheon() && !IsAwesome();
|
||||
return !IsPantheon();
|
||||
}
|
||||
|
||||
bool PreferAppIndicatorTrayIcon() {
|
||||
return IsXFCE() || IsUnity() || IsUbuntu() ||
|
||||
return (InSandbox() && !IsKDE())
|
||||
|| IsUnity()
|
||||
|| IsUbuntu()
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
(IsGnome() && QDBusInterface("org.kde.StatusNotifierWatcher", "/").isValid());
|
||||
|| (IsGnome() && QDBusInterface("org.kde.StatusNotifierWatcher", "/").isValid());
|
||||
#else
|
||||
IsGnome();
|
||||
|| IsGnome();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,7 @@ enum class Type {
|
|||
KDE5,
|
||||
Ubuntu,
|
||||
Unity,
|
||||
XFCE,
|
||||
Pantheon,
|
||||
Awesome,
|
||||
};
|
||||
|
||||
Type Get();
|
||||
|
@ -53,18 +51,10 @@ inline bool IsUnity() {
|
|||
return Get() == Type::Unity;
|
||||
}
|
||||
|
||||
inline bool IsXFCE() {
|
||||
return Get() == Type::XFCE;
|
||||
}
|
||||
|
||||
inline bool IsPantheon() {
|
||||
return Get() == Type::Pantheon;
|
||||
}
|
||||
|
||||
inline bool IsAwesome() {
|
||||
return Get() == Type::Awesome;
|
||||
}
|
||||
|
||||
bool TryQtTrayIcon();
|
||||
bool PreferAppIndicatorTrayIcon();
|
||||
|
||||
|
|
|
@ -384,6 +384,7 @@ bool OpenSystemSettings(SystemSettingsType type) {
|
|||
} else if (DesktopEnvironment::IsGnome()) {
|
||||
add("gnome-control-center sound");
|
||||
}
|
||||
add("pavucontrol-qt");
|
||||
add("pavucontrol");
|
||||
add("alsamixergui");
|
||||
return ranges::find_if(options, [](const QString &command) {
|
||||
|
|
Loading…
Reference in New Issue