Tdesktop: Telegram comes to focus when clicking notifications from other applications

Created on 21 Aug 2015  路  43Comments  路  Source: telegramdesktop/tdesktop

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):

  1. configure KDE notifications so that they have some buttons to push, e.g. "Show mail" for KMail.
  2. Start Telegram and minimize it to tray.
  3. Receive a button-containing-notification
  4. 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.

telegram-send

bug help wanted linux

Most helpful comment

The bug is still unfixed in the 1.17 branch.
Currently using 1.0.28, thanks to @jhasse (#3298).

Operating System: KDE neon 5.16
KDE Plasma Version: 5.16.3
Kernel Version: 4.18.0-25-generic

All 43 comments

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 =(
image

Tried Skype 5.5.0.1 - View button opens Skype not Telegram.
screenshot_20171005_000111

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
image

Here Telegram notification opens Telegram
image

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.

Based on what @Emerentius is saying, I think I have a similar problem with Telegram, although I'm not sure if it belongs in this issue.

When I click on the Telegram tray icon while Telegram doesn't have a window, it opens up in the foreground and takes focus properly. However, when I click on the tray icon while there is a Telegram window in the background or minimised, it will take focus - for example, if I then hit the Menu key on the keyboard, a context menu from Telegram opens - but it won't appear in the foreground, meaning that the Telegram window is accepting input and is technically focused, but I can't see it, because it's hidden behind other apps' windows. Subsequently clicking the tray icon again closes the 'phantom' window, and clicking it once again opens the Telegram window properly, as expected.

I'm running KDE Plasma 5.8.8 with KWin 5.8.8 on Linux Mint 18.2, focus stealing prevention set to none.

This has happened to me for a long time. Today, when I finally got pissed off, I start to search and find this.

I am using openSUSE Tumbleweed 20180208 with KDE Plasma 5.12.0, Qt: 5.10.0, and KDE Frameworks: 5.42.0. Whenever Kmail notifies me there is a new message, I click on the "Show mail" button and it brings up Telegram then Telegram takes the window focus.

I don't have this problem anymore, likely because I am using a version found in the Arch Linux [community] repo which is compiled using the system Qt and not with a custom patched Qt.

Thank you @z3ntu
I found an app (named Telegram Desktop) from https://software.opensuse.org for openSUSE and installed it with the old Telegram (AppImage?) removed. Now the problem is gone.

@z3ntu this solved it for me too, thanks

I am on 1.2.15, Fedora 27 with Plasma. The issue is really annoying, Telegram opens and focuses on any notification that is popped up. Switching to "native notifications" doesn't change anything. Is there any help that I can provide on debugging this? Had to install 1.2.6 (latest available stable) from RpmFusion.

I can reproduce this 100% of the times when clicking on the notification from any other application. All my notifications trigger telegram, nothing else. I'm using TopIcons Plus and KStatusNotifier support extensions on Gnome 3.26 and now 3.28. Telegram is installed from [community] on Arch (so combiled against system QT) as @z3ntu .

Clicking on Skype (skypeforlinux package) notifications made Telegram window active in the Taskbar in Kubuntu 18.04. Disabling the tray icon in Telegram settings fixed. this.

Hi everybody, I'm using Telegram desktop from Debian backports repositories and it seems it works as expected (without this bug).
Info:

Debian: 9.4
Package: telegram-desktop, Version: 1.1.23-1~bpo9+1
KDE Plasma Version: 5.8.6
KDE Frameworks Version: 5.28.0
Qt Version: 5.7.1
Kernel version: 4.9.0-6-amd64

Package link: https://packages.debian.org/stretch-backports/telegram-desktop

After upgrading to Ubuntu 18.04 (the default version using Gnome), this problem is now fixed.

Telegram was updated to version 1.2.17. This seems to be the equivalent of the official 1.3.10 in the package maintainer's versioning scheme (same change log message).

@Emerentius I can still reproduce it on NixOS with Telegram 1.3.10 and GNOME 3.28.

the same problem.

Fedora 29, 4.20.2-200.fc29.x86_64
Qt: 5.11.3
KDE Frameworks: 5.53.0
kf5-config: 1.0
plasmashell 5.14.4
Telegram Version 1.5.4

If you have this issue, one way to get rid of it (workaround) is to add XDG_CURRENT_DESKTOP=Unity as a prefix to the launch command of telegram.

In my fedora 29 (kde), this is found under

  • Right click App launcher
  • Edit applications
  • Unfold 'Internet'
  • Select Telegram Desktop
  • Change command to have XDG_CURRENT_DESKTOP=Unity at the beginning.

You must put a space after the prefix.

I know it is not a solution, but a workaround I wanted to share.

Same bug with clicking Slack notifications maximizing Telegram instead:
Kubuntu 18.10 4.18.0-15-generic
KDE Plasma: 5.13.5
KDE Frameworks: 5.50.0
Qt: 5.11.1
Telegram version 1.5.15

The bug is still unfixed in the 1.17 branch.
Currently using 1.0.28, thanks to @jhasse (#3298).

Operating System: KDE neon 5.16
KDE Plasma Version: 5.16.3
Kernel Version: 4.18.0-25-generic

Also have this issue.

screenfetch
                          ./+o+-       pashawnn@pashawnn-laptop
                  yyyyy- -yyyyyy+      OS: Ubuntu 18.10 cosmic
               ://+//////-yyyyyyo      Kernel: x86_64 Linux 4.18.0-25-generic
           .++ .:/++++++/-.+sss/`      Uptime: 4h 47m
         .:++o:  /++++++++/:--:/-      Packages: 3157
        o:+o+:++.`..```.-/oo+++++/     Shell: zsh 5.5.1
       .:+o:+o/.          `+sssoo+/    Resolution: 1366x768
  .++/+:+oo+o:`             /sssooo.   DE: KDE 5.50.0 / Plasma 5.13.5
 /+++//+:`oo+o               /::--:.   WM: KWin
 \+/+o+++`o++o               ++////.   WM Theme: Breeze
  .++.o+++oo+:`             /dddhhh.   GTK Theme: Breeze [GTK2/3]
       .+.o+oo:.          `oddhhhh+    Icon Theme: breeze
        \+.++o+o``-````.:ohdhhhhh+     Font: Noto Sans Regular
         `:o+++ `ohhhhhhhhyo++os:      CPU: AMD Ryzen 3 2200U with Radeon Vega Mobile Gfx @ 4x 2.5GHz [50.0掳C]
           .o:`.syhhhhhhh/.oo++o`      GPU: AMD/ATI Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series]
               /osyyyyyyo++ooo+++/     RAM: 4016MiB / 4851MiB
                   ````` +oo+++o\:    
                          `oo++.      

Also have this issue on Kubuntu 18.04
Telegram version: 1.8.4

plz when confirming one bug supply the telegram desktop version you are using, the os you are using, AND if linux the desktop environment (with version) you are using.

@Aokromes Updated comment

I'm having exactly the same issue too,

on Telegram 1.8.15
Arch Linux (latest)
KDE 5.63.0

I'm having the same issue and it's really annoying.

Telegram 1.8.15
KDE Neon
Plasma 5.17.1

i had the same issue, however, today i installed libappindicator-gtk3 and libappindicator-gtk2, so discord would show up in the tray for gnome, and since then telegram doesnt open on every popup anymore, so for me, fixing those libraries fixed it (using manjaro gnome)

By following @ZahnPastor 's comment. I only installed libappindicator-gtk3 and it fixed the issue.
Using manjaro-gnome.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeonTheOriginal picture LeonTheOriginal  路  3Comments

JhonSane picture JhonSane  路  3Comments

FunctionalHacker picture FunctionalHacker  路  3Comments

Yanrishatum picture Yanrishatum  路  3Comments

Liudvikas picture Liudvikas  路  3Comments