Bug 432293

Summary: telegram notification counter not working
Product: [Frameworks and Libraries] frameworks-kiconthemes Reporter: giuseppe <giuseppebelluzzi95>
Component: generalAssignee: Christoph Feck <cfeck>
Status: RESOLVED FIXED    
Severity: normal CC: aria, egdfree, fedin-ilja2010, gfdsa, katyaberezyaka, kde, kdelibs-bugs, nate, orivej, tynach2
Priority: NOR    
Version: 5.78.0   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=454761
Latest Commit: Version Fixed In: 5.79
Sentry Crash Report:

Description giuseppe 2021-01-30 00:31:13 UTC
PREMISE
I reported this bug on github (https://github.com/telegramdesktop/tdesktop/issues/10264) and I was referred to report it here since it seems to be a bug in KDE's kiconthemes framework

SUMMARY
The notification counter for telegram-desktop in the system tray is not counting unread messages. 

STEPS TO REPRODUCE
1. Install telegram-desktop 2.5.7.
2. open telegram desktop and be sure notifications are enabled
3. receive some messages

OBSERVED RESULT
The icon tray doesn't show any red dot or any number of received messages


EXPECTED RESULT
The notification counter in system-tray should become red and show a number of received messages


SOFTWARE/OS VERSIONS
Manjaro 20.2.1 + kernel 5.10.11
KDE Plasma Version: Plasma 5.20.5
KDE Frameworks Version: KDE 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

The bug is that QIcon::hasThemeIcon("telegram-attention-panel") returns true even when only telegram icon is present in the icon theme.
Comment 1 Kai Uwe Broulik 2021-01-30 07:00:21 UTC
I was told QIcon::hasThemeIcon("telegram-attention-panel") returns true with KIconEngine because it falls back to "telegram" which exists. Qt does not do that.

I think when explicitly checking for hasThemeIcon we don't really want to do that fallback dance? However, I don't know what else it would break if we changed that...
Comment 2 Kai Uwe Broulik 2021-01-30 07:12:56 UTC
Ok, so the bug is probably that KIconEngine::name() always returns the input name whereas Qt does a check for whether the icon("foo-bar") is actually what it got. Since KIconEngine always returns "foo-bar" even if it did a fallback to "foo", Qt will always consider it existing. Now this I would say is a genuine bug in KIconEngine/KIconLoader.
Comment 3 giuseppe 2021-01-30 09:30:21 UTC
(In reply to Kai Uwe Broulik from comment #2)
> Ok, so the bug is probably that KIconEngine::name() always returns the input
> name whereas Qt does a check for whether the icon("foo-bar") is actually
> what it got. Since KIconEngine always returns "foo-bar" even if it did a
> fallback to "foo", Qt will always consider it existing. Now this I would say
> is a genuine bug in KIconEngine/KIconLoader.

I don't understand a lot of technical details but it seems to be at a dead end.

This problem came out after telegram changed its behaviour about monochrome icons, now they only show a dot (as per request from many users with a monochrome icon theme). It worked perfectly before for normal icons. 

I don't know if can be of interest but if I download the binary from https://desktop.telegram.org/ it works as intended, even the beta version
Comment 4 ariasuni 2021-02-06 15:43:00 UTC
I believe this is fixed by:
https://invent.kde.org/frameworks/breeze-icons/-/merge_requests/81

This will be available in KDE Frameworks 5.79, which will be released this month:
https://community.kde.org/Schedules/Frameworks

(I asked on the merge request if it couldn’t be backported to avoid this feature be broken for too long for people who won’t get KDE Frameworks 5.79 soon)
Comment 5 giuseppe 2021-02-06 18:12:45 UTC
(In reply to ariasuni from comment #4)
> I believe this is fixed by:
> https://invent.kde.org/frameworks/breeze-icons/-/merge_requests/81
> 
> This will be available in KDE Frameworks 5.79, which will be released this
> month:
> https://community.kde.org/Schedules/Frameworks
> 
> (I asked on the merge request if it couldn’t be backported to avoid this
> feature be broken for too long for people who won’t get KDE Frameworks 5.79
> soon)

Seems good, I will give a try in a live system as soon as the 5.79 comes out, thank you. 
This should fix the monochrome icon problem and also give the possibility to have a message counter on it.
Comment 6 Ilya Fedin 2021-02-10 13:59:04 UTC
Why the bugreport is closed if the underlying bug in kiconthemes is still not fixed? Even if it won't be observable with the Breeze icon theme, it will still be observable with any third-party icon theme with color and without monochrome icon.
Comment 7 Nate Graham 2021-02-10 14:41:48 UTC
Fair enough.
Comment 8 Colin Griffith 2021-02-15 17:57:27 UTC
Okay, I'm on KDE Neon and just got the update that supposedly fixed this. It broke it.

I cannot see how many conversations have new messages for me in Telegram, instead only seeing a blue dot.

I have KDE Frameworks 5.79.
Comment 9 soredake 2022-05-26 16:22:58 UTC
Are there any progress on this? I really want to see notification counter in telegram's icon.
Comment 10 soredake 2022-06-02 17:09:43 UTC
https://bugs.kde.org/show_bug.cgi?id=454761
Comment 11 Bug Janitor Service 2022-09-19 15:46:11 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kiconthemes/-/merge_requests/79
Comment 12 Kai Uwe Broulik 2022-09-22 12:04:05 UTC
Git commit 1f48af65477ef1829bd07dc4bdb267ecca870be1 by Kai Uwe Broulik.
Committed on 20/09/2022 at 09:18.
Pushed by broulik into branch 'master'.

KIconEngine: Return actual icon name of loaded icon

XDG icon themes return a "more generic" fallback icon if the
requested one cannot be found, e.g. `foo-bar` may return `foo`.

Previously, the returned `QIcon` would still return a name
of `foo-bar`, which made it impossible for applications to
check whether the specific icon requested was actually loaded.

M  +7    -0    autotests/kiconengine_unittest.cpp
M  +26   -6    src/kiconengine.cpp
M  +24   -13   src/kiconloader.cpp
M  +9    -1    src/kiconloader_p.h

https://invent.kde.org/frameworks/kiconthemes/commit/1f48af65477ef1829bd07dc4bdb267ecca870be1
Comment 13 soredake 2022-11-03 15:31:09 UTC
Is this really fixed? I'm on opensuse leap kde 15.4 with last kde software and i still see kde's icon without counter.
Comment 14 Ilya Fedin 2022-11-03 15:42:59 UTC
Are you sure you have non-monochrome icon? This bug is about non-monochrome icon not having the counter when it's supposed to. The monochrome icon is not supposed to have the counter and that's intended from Telegram side.
Comment 15 soredake 2022-11-03 15:54:44 UTC
(In reply to Ilya Fedin from comment #14)
> Are you sure you have non-monochrome icon? This bug is about non-monochrome
> icon not having the counter when it's supposed to. The monochrome icon is
> not supposed to have the counter and that's intended from Telegram side.

I get monochrome icon with dot, still, i use telegram from flatpak.
Comment 16 Ilya Fedin 2022-11-03 15:58:08 UTC
So it works as intended
Comment 17 soredake 2022-11-03 16:00:19 UTC
This bug title is "telegram notification counter not working"

I description we have this:
```

OBSERVED RESULT
The icon tray doesn't show any red dot or any number of received messages


EXPECTED RESULT
The notification counter in system-tray should become red and show a number of received messages
```

 Bug closed as "Resolved Fixed".

The question is, what's fixed if notification counter is still not working?
Comment 18 Ilya Fedin 2022-11-03 16:01:55 UTC
I explained in the previous message, please re-read it.