Skip to content

Commit

Permalink
Fix invisible tray icon on Plasma 6 in Linux
Browse files Browse the repository at this point in the history
PR #20529.
Closes #20367.

---------

Co-authored-by: thalieht <thalieht@users.noreply.github.com>
Co-authored-by: Vladimir Golovnev <glassez@yandex.ru>
  • Loading branch information
3 people authored Mar 13, 2024
1 parent d5e41bf commit 50caa23
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/gui/desktopintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <chrono>

#include <QtEnvironmentVariables>
#include <QMenu>
#include <QTimer>

Expand Down Expand Up @@ -283,17 +284,25 @@ void DesktopIntegration::createTrayIcon()
QIcon DesktopIntegration::getSystrayIcon() const
{
const TrayIcon::Style style = Preferences::instance()->trayIconStyle();
QIcon icon;
switch (style)
{
default:
case TrayIcon::Style::Normal:
return UIThemeManager::instance()->getIcon(u"qbittorrent-tray"_s);

icon = UIThemeManager::instance()->getIcon(u"qbittorrent-tray"_s);
break;
case TrayIcon::Style::MonoDark:
return UIThemeManager::instance()->getIcon(u"qbittorrent-tray-dark"_s);

icon = UIThemeManager::instance()->getIcon(u"qbittorrent-tray-dark"_s);
break;
case TrayIcon::Style::MonoLight:
return UIThemeManager::instance()->getIcon(u"qbittorrent-tray-light"_s);
icon = UIThemeManager::instance()->getIcon(u"qbittorrent-tray-light"_s);
break;
}
#ifdef Q_OS_UNIX
// Workaround for invisible tray icon in KDE, https://bugreports.qt.io/browse/QTBUG-53550
if (qEnvironmentVariable("XDG_CURRENT_DESKTOP").compare(u"KDE", Qt::CaseInsensitive) == 0)
return icon.pixmap(32);
#endif
return icon;
}
#endif // Q_OS_MACOS

0 comments on commit 50caa23

Please sign in to comment.