Bug 449108 - Discover launches all launchables of an app's AppStream ID when clicking the "Launch" button
Summary: Discover launches all launchables of an app's AppStream ID when clicking the ...
Status: RESOLVED FIXED
Alias: None
Product: Discover
Classification: Applications
Component: PackageKit (show other bugs)
Version: 5.23.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dan Leinir Turthra Jensen
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2022-01-24 23:03 UTC by Gabriel
Modified: 2022-03-18 00:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
The two examples found of this happening (1.16 MB, image/png)
2022-01-24 23:03 UTC, Gabriel
Details
Screen recording of the thing (795.90 KB, video/mp4)
2022-01-25 22:16 UTC, Gabriel
Details
Recording of opening Connect through Discover (501.14 KB, video/mp4)
2022-01-26 11:23 UTC, Gabriel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriel 2022-01-24 23:03:18 UTC
Created attachment 145896 [details]
The two examples found of this happening

SUMMARY
Discover has a handy "Launch" button which should help a user get right to the application after install. Krita is a fascinating exception, instead getting launched around 20× over. KDE Connect is similar but less extreme, getting launched 5 times. (See the attached screenshot)

STEPS TO REPRODUCE
1. Open Discover
2. Install Krita or KDE Connect
3. Click the "Launch" option

OBSERVED RESULT
The application gets launched a lot of times

EXPECTED RESULT
The application gets launched once

SOFTWARE
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
- Testing this with KDE Connect will be much kinder to your computer. I recommend trying that if you want to check out the bug.
- This bug seems to be caused by Discover launching all desktop files associated with a program, not just the one you get in your application menu. I assume this from all the entries of the respective software in /usr/share/applications/.
Comment 1 Nate Graham 2022-01-25 21:37:10 UTC
I can reproduce this with any multi-instance app if I click the "Launch" button multiple times while the app is still launching. Is that what you're doing? I can't get it to happen if I only click on the Launch button only once.
Comment 2 Gabriel 2022-01-25 22:05:19 UTC
No, this occurs specifically with applications like Krita and it only requires a single click. Sorry if that was unclear. Did you try Krita or KDE Connect specifically? I can provide a screen recording if that is helpful. :^)
Comment 3 Gabriel 2022-01-25 22:16:33 UTC
Created attachment 145942 [details]
Screen recording of the thing

I hope this clarifies. I didn't leave the recording for long enough that all windows finally loaded, but it's enough to cause some crash (within Krita) and sets my computer to a cozy temperature. Note that this is a single click.
Comment 4 Nate Graham 2022-01-25 22:57:35 UTC
I cannot reproduce the issue with Krita, but I think I might be able to with KDE Connect. Three windows are opened when I click "Launch". However they are all different. I suspect what's happening here is that Discover is launching all launchables that correspond to the AppStream ID of the thing you clicked "Launch" for, and, it just happens that there are three for KDE Connect.

Not sure about Krita though. Can you attach a screen recording of the issue happening with KDE Connect so I can see if I experienced the same thing as you?
Comment 5 Gabriel 2022-01-25 23:17:28 UTC
(In reply to Nate Graham from comment #4)
> I cannot reproduce the issue with Krita, but I think I might be able to with KDE Connect.
> Three windows are opened when I click "Launch". However they are all different.
Interesting that it doesn't work for you in Krita. Do you have it installed as a Flatpak? I'm on KDE Neon, so I got it through the official repos. Yes, the KDE Connect windows are all different for me as well. It's the same as if you open /usr/share/applications/ and click all desktop files that relate to the app.
> I suspect what's happening here is that Discover is launching all launchables that correspond
> to the AppStream ID of the thing you clicked "Launch" for, and, it just happens that there are
> three for KDE Connect.
This is what I suspect as well…

> Not sure about Krita though. Can you attach a screen recording of the issue happening with
> KDE Connect so I can see if I experienced the same thing as you?
Absolutely! Though, it's late here now so I'll get to it tomorrow. In the meantime I can confirm that you seem to have gotten the same result as me there.
Comment 6 Gabriel 2022-01-26 11:23:02 UTC
Created attachment 145949 [details]
Recording of opening Connect through Discover

Here's how it looks when launching KDE Connect through Discover. I guess it's the same as what you described?
I also checked and found out that Flatpak versions do not suffer from this same issue. I guess they can create no more than one desktop file per application? Not checking this before was an oversight on my part, sorry. It's good to know this now. :^)
Comment 7 Nate Graham 2022-01-26 15:45:51 UTC
Yep, that's what I see too.
Comment 8 Aleix Pol 2022-03-18 00:59:55 UTC
Git commit d3fa32a3008f5ace0a66f24f869ddb14f40a6c2e by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 18/03/2022 at 00:44.
Pushed by apol into branch 'master'.

pk: Use appstream information to launch an app

We no longer need to do weird package introspection to find the
executable.

M  +9    -46   libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp

https://invent.kde.org/plasma/discover/commit/d3fa32a3008f5ace0a66f24f869ddb14f40a6c2e