From 2fe2105a5f6ab44e5175fc771426177f91680133 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 15 Jan 2021 14:02:48 +0400 Subject: [PATCH] Don't add counter when icon theme has 'panel' icon These icons should have a dot indicating unread messages, counter is redudant for them --- .../platform/linux/main_window_linux.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index e99aef7d02..e25200c246 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -204,6 +204,13 @@ QIcon TrayIconGen(int counter, bool muted) { } const auto iconName = GetTrayIconName(counter, muted); + const auto panelIconName = GetPanelIconName(counter, muted); + + if (iconName == panelIconName) { + const auto result = QIcon::fromTheme(iconName); + UpdateIconRegenerationNeeded(result, counter, muted, iconThemeName); + return result; + } QIcon result; QIcon systemIcon; @@ -624,7 +631,17 @@ void MainWindow::psTrayMenuUpdated() { #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION void MainWindow::setSNITrayIcon(int counter, bool muted) { - if (IsIndicatorApplication()) { + const auto iconName = GetTrayIconName(counter, muted); + const auto panelIconName = GetPanelIconName(counter, muted); + + if (iconName == panelIconName) { + if (_sniTrayIcon->iconName() == iconName) { + return; + } + + _sniTrayIcon->setIconByName(iconName); + _sniTrayIcon->setToolTipIconByName(iconName); + } else if (IsIndicatorApplication()) { if (!IsIconRegenerationNeeded(counter, muted) && _trayIconFile && _sniTrayIcon->iconName() == _trayIconFile->fileName()) {