Telegram comes to focus when clicking notifications from other applications
I actually don't know if this is Telegram or KDE bug, but when Telegram is launched and minimized to tray and a new e-mail arrives triggering a "New mail notification" and you push "Show mail" button -> Telegram desktop app is maximized. The same is when you get a download finished in FireFox and receive a notification with a button "Open" (to open a folder with the downloaded file). Push the button and for some reason Telegram app is maximized. I use gentoo. Telegram app is simply downloaded from its web-site.
So, steps to reproduce (always for me):
- configure KDE notifications so that they have some buttons to push, e.g. "Show mail" for KMail.
- Start Telegram and minimize it to tray.
- Receive a button-containing-notification
- Push a button in it.
Expected result: Show a KMail with new message. Actual result: Telegram is maximized and focused. The new message is opened in a background. Reproduces always.
I attach a screenshot with an example of the notifications and buttons.

Actually even when Telegram is not minimezed, on the button-press it is focused in the first place and only after it that the intended button-action takes place.
You may want to take a look here too: https://bugs.gentoo.org/show_bug.cgi?id=537266
I get the same effect using Firefox with Gnotifier when clicking the action button on the notification, on Plasma Desktop 5.7.3 and telegram-desktop-bin from the AUR on Arch Linux.
Well, not maximized, but raised.
Hi, I have the same issue, but I'm using Debian 8.8 and KDE 4.14.2.
Pull request with a fix would help a lot :)
So it happens on KDE4&5 and GNOME3?
It happened to me on Plasma5 too (SUSE Tumbleweed April-May, 2017).
Same on KDE Plasma 5.10.5
Can't reproduce with latest Telegram, KDE Plasma 5.5.5, Qt 5.5.1, Linux Mint 18.2, Kernel 4.10.0-35-generic.
I've tried KMail 5.1.3, but its notifications don't have any buttons =(

Tried Skype 5.5.0.1 - View button opens Skype not Telegram.

There must be something else in this case.
@roman-voropaev I can reproduce with eg browser notifications from both Firefox and Chrome. Can you try https://jsbin.com/ziwod/2/edit?html,js,output ?
@z3ntu web notification returns focus to Firefox

Here Telegram notification opens Telegram

Started getting the same issue recently, Telegram 1.1.23 alpha, GNOME Shell version 3.24
Okay, not sure why this is happening, but I found that it stopped after I disabled the KStatusNotifierItem extension for gnome. It seems that this issue only occurs when Telegram is using an AppIndicator / KStatusNotifier tray icon, not the old style tray icon.
I'm getting this in Ubuntu with Gnome shell 3.26.1 and "Topicons - legacy tray icons" extension. Any notification from Firefox or any other application focuses Telegram when it's clicked. This is independent of whether Telegram is open, closed, maximized or minimized.
As referenced above, this happens for both Telegram and Mega programs.
@jhasse Do you maybe know why this happens?
Sorry, no idea whatsoever :(
I'm also seeing this bug but when I'm actively testing for it, it's inconsistent. Sometimes Telegram opens up, sometimes it doesn't, sometimes I just get an extra notification "Telegram is ready" after clicking the original notification without telegram popping up.
It's actually mostly the latter two in a run of 20 notifications tests.
I can reproduce the issue 100% of the time with Firefox and the example at https://developer.mozilla.org/en-US/docs/Web/API/notification#Example (scroll down a bit to the "Notify me!" button)
Well at least I found a regularity For me telegram pops into focus when it's hidden in the tray. If it's open in the task bar, I get the second notification "Telegram is ready" but it stays in the background. Doesn't matter if Telegram is minimized or not. After that first ready-notification, no more appear on subsequent notifications unless telegram is brought into focus again.
For completeness sake, this is on ubuntu 17.10 with gnome 3.26 under both wayland and x11.
It's also NOT happening with thunderbird notifications.