diff --git a/src/widget/systemtrayicon.cpp b/src/widget/systemtrayicon.cpp index 190a41dfe..2195cf807 100644 --- a/src/widget/systemtrayicon.cpp +++ b/src/widget/systemtrayicon.cpp @@ -356,3 +356,8 @@ void SystemTrayIcon::setIcon(QIcon &icon) qtIcon->setIcon(icon); } } + +SystrayBackendType SystemTrayIcon::backend() const +{ + return backendType; +} diff --git a/src/widget/systemtrayicon.h b/src/widget/systemtrayicon.h index 1ec26ea00..a63cb50b7 100644 --- a/src/widget/systemtrayicon.h +++ b/src/widget/systemtrayicon.h @@ -38,6 +38,7 @@ public: void hide(); void setVisible(bool); void setIcon(QIcon &icon); + SystrayBackendType backend() const; signals: void activated(QSystemTrayIcon::ActivationReason); diff --git a/src/widget/systemtrayicon_private.h b/src/widget/systemtrayicon_private.h index 4b973d400..bbe8c74d8 100644 --- a/src/widget/systemtrayicon_private.h +++ b/src/widget/systemtrayicon_private.h @@ -63,15 +63,9 @@ extern "C" { enum class SystrayBackendType { Qt, -#ifdef ENABLE_SYSTRAY_UNITY_BACKEND Unity, -#endif -#ifdef ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND StatusNotifier, -#endif -#ifdef ENABLE_SYSTRAY_GTK_BACKEND - GTK, -#endif + GTK }; #endif // SYSTEMTRAYICON_PRIVATE_H diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 329ed52c8..11798a7b5 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1815,7 +1815,9 @@ void Widget::onTryCreateTrayIcon() trayMenu->addAction(actionQuit); icon->setContextMenu(trayMenu); - connect(icon, &SystemTrayIcon::activated, this, &Widget::onIconClick); + // don't activate qTox widget on tray icon click in Unity backend (see #3419) + if (icon->backend() != SystrayBackendType::Unity) + connect(icon, &SystemTrayIcon::activated, this, &Widget::onIconClick); if (Settings::getInstance().getShowSystemTray()) {