From bc3723d4620718dfe8bd0165e9ef8ba45a3da262 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 10 Feb 2022 02:18:30 +0400 Subject: [PATCH] Make indicator-application hack work in flatpak Flatpak doesn't share $XDG_RUNTIME_DIR with the host making QSystemTrayIcon not to work on Xubuntu/Ubuntu MATE/Ubuntu Budgie. Although, it shares a subfolder, according to https://docs.flatpak.org/en/latest/sandbox-permissions.html Amends 0baa26638d7d14b6609dab191c4ea0cc1d3ff50a Pick-to: 6.3 6.2 5.15 Change-Id: I2d0043fc5a4c2c51e8fa1a920f3cada3b07eba6d Reviewed-by: Dmitry Shachnev Reviewed-by: Aleix Pol Gonzalez --- src/gui/platform/unix/dbustray/qdbustrayicon.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/platform/unix/dbustray/qdbustrayicon.cpp b/src/gui/platform/unix/dbustray/qdbustrayicon.cpp index 892a99d726..57c1b65cde 100644 --- a/src/gui/platform/unix/dbustray/qdbustrayicon.cpp +++ b/src/gui/platform/unix/dbustray/qdbustrayicon.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -76,8 +77,12 @@ Q_LOGGING_CATEGORY(qLcTray, "qt.qpa.tray") static QString iconTempPath() { QString tempPath = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); - if (!tempPath.isEmpty()) + if (!tempPath.isEmpty()) { + QString flatpakId = qEnvironmentVariable("FLATPAK_ID"); + if (!flatpakId.isEmpty() && QFileInfo::exists(QLatin1String("/.flatpak-info"))) + tempPath += QLatin1String("/app/") + flatpakId; return tempPath; + } tempPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);