Bug 460796

Summary: KRunner shouldn't be looking for .desktop filenames when searching applications
Product: [Plasma] krunner Reporter: me
Component: generalAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: normal CC: alexander.lohnau, nate
Priority: NOR    
Version: 5.26.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.26.3
Attachments: An example of KRunner defaulting to the wrong application because of its .desktop filename
The .desktop file for the Twitter web app (Chromium)

Description me 2022-10-21 09:02:15 UTC
Created attachment 153075 [details]
An example of KRunner defaulting to the wrong application because of its .desktop filename

STEPS TO REPRODUCE
1. Search for an application with a name similar to another application's .desktop filename

OBSERVED RESULT
Often times the one with the matching .desktop filename comes on top even if the actual name of the application does not contain the search query.

EXPECTED RESULT
The correct application name should be on top since KRunner shouldn't look for .desktop filenames.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 5.26.0
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Comment 1 Alexander Lohnau 2022-10-28 05:19:10 UTC
I am not able to reproduce. Please attach the desktop file to this bug report.

For context: I did https://invent.kde.org/plasma/plasma-workspace/-/commit/ac22a4f170d08552a6e7b00f77cd23dc244010fd a while ago, which is related to the described issue.
Comment 2 Alexander Lohnau 2022-10-28 10:10:37 UTC
Changing status to NEEDSINFO
Comment 3 me 2022-10-28 12:23:17 UTC
Created attachment 153260 [details]
The .desktop file for the Twitter web app (Chromium)
Comment 4 Alexander Lohnau 2022-10-28 15:17:43 UTC
Though here the issues is not the filename, but the exec values.
Comment 5 Bug Janitor Service 2022-10-30 15:20:30 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2283
Comment 6 Nate Graham 2022-10-31 17:11:35 UTC
Git commit ce7c10b31c315867817e860a7c4929892a3b4344 by Nate Graham, on behalf of Alexander Lohnau.
Committed on 31/10/2022 at 16:32.
Pushed by ngraham into branch 'master'.

runners/services: Do not match exec values of PWAs

Checking the StartupWMClass is cheap from a performance POV and
avoids false positives that one might have when checking the exec
for the executable name and arguments.

A  +11   -0    runners/services/autotests/fixtures/chrome-kjgfgldnnfoeklkmfkjfagphfepbbdan-Default.desktop
M  +40   -0    runners/services/autotests/servicerunnertest.cpp
M  +8    -1    runners/services/servicerunner.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/ce7c10b31c315867817e860a7c4929892a3b4344
Comment 7 Nate Graham 2022-10-31 17:19:28 UTC
Git commit 994fbffcae9a357d0d3cd4a9b6b64a9c6644ffbd by Nate Graham, on behalf of Alexander Lohnau.
Committed on 31/10/2022 at 17:17.
Pushed by ngraham into branch 'Plasma/5.26'.

runners/services: Do not match exec values of PWAs

Checking the StartupWMClass is cheap from a performance POV and
avoids false positives that one might have when checking the exec
for the executable name and arguments.
(cherry picked from commit ce7c10b31c315867817e860a7c4929892a3b4344)

A  +11   -0    runners/services/autotests/fixtures/chrome-kjgfgldnnfoeklkmfkjfagphfepbbdan-Default.desktop
M  +40   -0    runners/services/autotests/servicerunnertest.cpp
M  +8    -1    runners/services/servicerunner.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/994fbffcae9a357d0d3cd4a9b6b64a9c6644ffbd
Comment 8 Fushan Wen 2022-11-05 01:09:10 UTC
Git commit e206162b8ef3ad028aa66d3ad12338a4cb1683f2 by Fushan Wen.
Committed on 05/11/2022 at 01:08.
Pushed by fusionfuture into branch 'master'.

runners/services: fix test failure

M  +2    -3    runners/services/autotests/servicerunnertest.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/e206162b8ef3ad028aa66d3ad12338a4cb1683f2