Bug 498292

Summary: Applications with Shared Names do not show up When Searching
Product: [Plasma] krunner Reporter: frafortunelli
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: REPORTED ---    
Severity: minor CC: alexander.lohnau, duha.bugs, natalie_clarius, nate
Priority: NOR    
Version First Reported In: 6.2.4   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Picture Comparison showing how both applications exist under "education" section but only one application is shown through a text search for the application.

Description frafortunelli 2025-01-05 21:43:07 UTC
Created attachment 177134 [details]
Picture Comparison showing how both applications exist under "education" section but only one application is shown through a text search for the application.

SUMMARY
When searching for applications not all of them are shown if they share the beginning of the name. 


STEPS TO REPRODUCE
1. Have two applications that share the initial part of the same name. For example "FreeCAD" and "FreeCAD Big Assembly". 
2. Click Super Key to start search from Desktop. Type in "FreeCAD." 


OBSERVED RESULT
Only "FreeCAD Big Assembly" is shown. 


EXPECTED RESULT
Expect both "FreeCAD" and "FreeCAD Big Assembly" to show. 

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Bazzite 41
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1

ADDITIONAL INFORMATION
Comment 1 duha.bugs 2025-01-06 12:41:14 UTC
This seems to work correctly for me with other programs. How did you install both of those programs?
Comment 2 frafortunelli 2025-01-06 18:00:16 UTC
FreeCAD was installed as a flatpak and autogenerated the .desktop file. I then created the "FreeCAD Big Assembly" application though the application launcher by righ clicking edit applications -> new item -> making my customizations and saving. When I go into application details I do notice that the .desktops are shared in different places. The flatpak one is at /var/lib/flatpak/app/org.freecad.FreeCAD/current/active/export/share/applications/org.freecad.FreeCAD.desktop while the custom one is at /var/home/$user/.local/share/applications/org.freecad.FreeCAD-3. Not sure if this helps. Let me know if there is anything else I should check.
Comment 3 duha.bugs 2025-01-06 18:12:57 UTC
I assume there is something wrong with your self created desktop file. Ill try to reproduce with the steps you have given me.

Can you check if it works when you rename your self created desktop file to something unique that does share a name?
Comment 4 frafortunelli 2025-01-06 18:26:49 UTC
The .desktop files for comparison: 
FreeCAD:
[Desktop Entry]
Name=FreeCAD
Name[de]=FreeCAD
Name[ko]=FreeCAD
Name[pl]=FreeCAD
Name[ru]=FreeCAD
Comment=Feature based Parametric Modeler
Comment[de]=Feature-basierter parametrischer Modellierer
Comment[ko]=형상 기반 파라메트릭 모델링 도구
Comment[pl]=Modeler parametryczny oparty na cechach
Comment[ru]=Система автоматизированного проектирования
GenericName=CAD Application
GenericName[de]=CAD-Anwendung
GenericName[ko]=CAD 응용프로그램
GenericName[pl]=Aplikacja CAD
GenericName[ru]=Система автоматизированного проектирования
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=FreeCAD --file-forwarding org.freecad.FreeCAD - --single-instance @@ %F @@
Terminal=false
Type=Application
Icon=org.freecad.FreeCAD
Categories=Graphics;Science;Education;Engineering;X-CNC;
StartupNotify=true
StartupWMClass=FreeCAD
MimeType=application/x-extension-fcstd;model/obj;image/vnd.dwg;image/vnd.dxf;model/vnd.collada+xml;application/iges;model/iges;model/step;model/step+zip;model/stl;application/vnd.shp;model/vrml;
X-Flatpak=org.freecad.FreeCAD

FreeCAD Big Assembly: 
[Desktop Entry]
Comment=Feature based Parametric Modeler
Exec=env __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=FreeCAD --file-forwarding org.freecad.FreeCAD - --single-instance @@ %F @@
GenericName=CAD Application
Icon=org.freecad.FreeCAD
MimeType=application/x-extension-fcstd;model/obj;image/vnd.dwg;image/vnd.dxf;model/vnd.collada+xml;application/iges;model/iges;model/step;model/step+zip;model/stl;application/vnd.shp;model/vrml;
Name=FreeCAD Big Assembly
NoDisplay=false
Path=
StartupNotify=true
StartupWMClass=FreeCAD
Terminal=false
TerminalOptions=
Type=Application
X-Flatpak=org.freecad.FreeCAD
X-KDE-SubstituteUID=false
X-KDE-Username=

I also did some testing. 
If I type in "FreeCAD" or "Free..." only the FreeCAD application shows up, but if I search "FreeCAD B..." then only "FreeCAD Big Assembly" application shows. I would expect both applications to show when FreeCAD is typed in but they are not. 
If I rename "FreeCAD Big Assembly" to "Big Assembly FreeCAD" similar behaviour happens.
Comment 5 Alexander Lohnau 2025-01-06 21:28:22 UTC
Oh, so the difference between those files is just the ENV variables? I think this gets caught by the deduplication logic. Meaning KRunner thinks the exec of those is basically the same.

Initially, we just did this for snaps, but commit 7a7b9299571c533c63d3f8775e5b0165208c9bae did it for all env variables. Not sure how to best solve this, since for some cases it is the preferred behavior.
Comment 6 frafortunelli 2025-01-22 15:35:10 UTC
An "workaround" is creating a simple bash script that runs the flatpak with the additional environment variables, which is what I've settled on for now.