Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 798420 - >=net-im/telegram-desktop-2.7.4: does not launch opening a t.me link from the browser on KDE
Summary: >=net-im/telegram-desktop-2.7.4: does not launch opening a t.me link from the...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Esteve Varela Colominas
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-24 15:26 UTC by Marco Scardovi (scardracs)
Modified: 2022-01-22 09:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
screenshot (tgme.png,26.56 KB, image/png)
2021-06-24 20:53 UTC, Georgy Yakovlev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Scardovi (scardracs) 2021-06-24 15:26:52 UTC
Following this reddit subforum [1] I've noticed I had same problem on my PC. In short if you try to launch a t.me/* link it will not open the link but fails with a KIOexec error. The simple way to handle with it is to remove the local desktop file and maintain only the one in /usr/share using the command [2].
This error was discovered with latest telegram (not tested with bin version) and plasma 5.22.2.

References:

[1] https://www.reddit.com/r/ManjaroLinux/comments/k76cph/telegram_not_launching_from_the_browser_xdgopen/
[2] rm -i "$(grep -l telegram ~/.local/share/applications/*.desktop)"
Comment 1 Esteve Varela Colominas 2021-06-24 16:44:58 UTC
Desktop files are supplied upstream, but even right now this seems to be working just fine, using the open_generic() implementation of /usr/bin/xdg-open.
It has some issues locating the "userapp-Telegram Desktop" file due to the space in the name (it breaks in /usr/bin/xdg-mime, line 299 and 301). Renaming it, and fixing the name in ~/.config/mimeapps.list, it finds the correct file and still works (tested with "xdg-mime query default x-scheme-handler/tg"). Are you sure it's added correctly to both the "Default Applications" *and* the "Added Associations" lists on your machine?

So, it seems to be an issue with "kio open" or related to KDE somehow. Since this is all upstream behavior, I'll forward it upstream (assuming no issue about the matter exists yet), though we should consider why we wouldn't just patch out the desktop file/association creation downstream, since it's installed system-wide, anyway.
Comment 2 Marco Scardovi (scardracs) 2021-06-24 16:49:21 UTC
I have not checked for things are you saying. I can only confirm removing the user desktop fix it
Comment 3 Esteve Varela Colominas 2021-06-24 17:44:00 UTC
If you can check the contents of ~/.config/mimeapps.list for me, that'd be great, since it might point to the issue. Alternatively, also check whatever xdg-mime returns.

I've submitted the bug upstream, but it's not yet clear if this is some upstream or xdg-utils or Qt issue. See here: https://github.com/telegramdesktop/tdesktop/issues/16478
Comment 4 Marco Scardovi (scardracs) 2021-06-24 20:05:13 UTC
(In reply to Esteve Varela Colominas from comment #3)
> If you can check the contents of ~/.config/mimeapps.list for me, that'd be
> great, since it might point to the issue. Alternatively, also check whatever
> xdg-mime returns.
> 
> I've submitted the bug upstream, but it's not yet clear if this is some
> upstream or xdg-utils or Qt issue. See here:
> https://github.com/telegramdesktop/tdesktop/issues/16478

Sorry for late response, I was a bit busy:

[Added Associations]
application/octet-stream=org.kde.kate.desktop;
application/pdf=firefox-bin-wayland.desktop;
application/x-compressed-tar=org.kde.ark.desktop;
application/x-extension-htm=firefox-bin.desktop;userapp-Firefox-QS9O20.desktop;
application/x-extension-html=firefox-bin.desktop;userapp-Firefox-QS9O20.desktop;
application/x-extension-shtml=firefox-bin.desktop;userapp-Firefox-QS9O20.desktop;
application/x-extension-xht=firefox-bin.desktop;userapp-Firefox-QS9O20.desktop;
application/x-extension-xhtml=firefox-bin.desktop;userapp-Firefox-QS9O20.desktop;
application/xhtml+xml=firefox-bin.desktop;userapp-Firefox-QS9O20.desktop;
application/xml=org.kde.kate.desktop;
text/html=firefox-bin.desktop;userapp-Firefox-QS9O20.desktop;
x-scheme-handler/chrome=firefox-bin.desktop;userapp-Firefox-QS9O20.desktop;
x-scheme-handler/http=firefox-bin.desktop;userapp-Firefox-QS9O20.desktop;
x-scheme-handler/https=firefox-bin.desktop;userapp-Firefox-QS9O20.desktop;
x-scheme-handler/tg=userapp-Telegram Desktop-LPHB20.desktop;userapp-Telegram Desktop-UO3120.desktop;

[Default Applications]
application/octet-stream=org.kde.kate.desktop;
application/pdf=firefox-bin-wayland.desktop;
application/x-compressed-tar=org.kde.ark.desktop;
application/x-extension-htm=firefox-bin.desktop
application/x-extension-html=firefox-bin.desktop
application/x-extension-shtml=firefox-bin.desktop
application/x-extension-xht=firefox-bin.desktop
application/x-extension-xhtml=firefox-bin.desktop
application/xhtml+xml=firefox-bin.desktop
application/xml=org.kde.kate.desktop;
text/html=firefox-bin.desktop
x-scheme-handler/callto=skypeforlinux.desktop
x-scheme-handler/chrome=firefox-bin.desktop
x-scheme-handler/discord-668477264995811338=nuclear.desktop
x-scheme-handler/element=element-desktop.desktop
x-scheme-handler/http=firefox-bin.desktop
x-scheme-handler/https=firefox-bin.desktop
x-scheme-handler/msteams=teams.desktop
x-scheme-handler/skype=skypeforlinux.desktop
x-scheme-handler/tel=skypeforlinux.desktop
x-scheme-handler/tg=userapp-Telegram Desktop-UO3120.desktop
x-scheme-handler/webcal=google-chrome.desktop
x-scheme-handler/mailto=google-chrome.desktop
Comment 5 Georgy Yakovlev archtester gentoo-dev 2021-06-24 20:53:34 UTC
Created attachment 718926 [details]
screenshot

plasma 5.22.2 here,
works fine.
Comment 6 Georgy Yakovlev archtester gentoo-dev 2021-06-24 20:57:41 UTC
tested firefox and chromium, and xdg-open.
Comment 7 Marco Scardovi (scardracs) 2021-06-24 21:15:47 UTC
I've cleaned the file and will see if i have any problem (probably the problem was born when i had removed Firefox and it's entries still were on the file)
Comment 8 Esteve Varela Colominas 2021-06-24 21:16:18 UTC
@scardracs:

Interesting, at least everything seems to be configured just fine. Then it might just be a difference in behavior between xdg-open's open_generic() and xdg-open's open_kde()/kio open

@gyakovlev:

That's weird, do you use KDE, and do you have a "userapp-Telegram Desktop" entry in your ~/.local/share/applications and ~/.config/mimeapps.list?
Comment 9 Georgy Yakovlev archtester gentoo-dev 2021-06-25 00:35:21 UTC
(In reply to Esteve Varela Colominas from comment #8)
> @scardracs:
> 
> Interesting, at least everything seems to be configured just fine. Then it
> might just be a difference in behavior between xdg-open's open_generic() and
> xdg-open's open_kde()/kio open
> 
> @gyakovlev:
> 
> That's weird, do you use KDE, and do you have a "userapp-Telegram Desktop"
> entry in your ~/.local/share/applications and ~/.config/mimeapps.list?

nothing there mentioning telegram, it just works for me =)
yeah, using plasma full time.
Comment 10 Esteve Varela Colominas 2021-06-27 16:32:31 UTC
Short update: The bug has been reported to KDE, as it seems Telegram's creation of this file to set Telegram to be the default handler for the tg:// protocol is "correct", since it can't rely on the presence/name of a global desktop entry for that. It creates the file and association using glib's AppInfo module.
Upstream KDE report: https://bugs.kde.org/show_bug.cgi?id=439132

@gyakovlev:
The fact telegram places a userapp-*.desktop in the local directory is what causes it to break. I'm not sure when it's created, but it seems to be whenever it detects the "Exec=" line of the currently default opener for the tg:// protocol doesn't match a runtime-generated string. This happens to force telegram to always be the default opener for tg:// links and seems to be the desired (cross-platform consistent) behavior by upstream. I think it's a bit excessive since it hampers people who desire to use multiple clients and pick their default client, but I'm not the one calling the shots, and it seems to be consistent with other IM clients like Discord and Teams, unfortunately.
Comment 11 Marco Scardovi (scardracs) 2022-01-21 21:23:44 UTC
Closing as it works now.
Comment 12 Esteve Varela Colominas 2022-01-22 09:18:05 UTC
Thanks for checking!