Bug 442413

Summary: When opening files from GTK apps, the wrong app is triggered
Product: [Plasma] plasmashell Reporter: 61kylyqt
Component: generalAssignee: David Edmundson <kde>
Status: RESOLVED WAITINGFORINFO    
Severity: normal CC: plasma-bugs-null
Priority: NOR    
Version First Reported In: 5.21.5   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: PDFs opening in GIMP, despite Okular being the preferred app

Description 61kylyqt 2021-09-14 04:18:10 UTC
SUMMARY
In Firefox, when opening the files from the downloads menu, the file always open in the wrong application (PNG images in Chromium or in ImageMagick, PDFs in GIMP etc). This happens even with the file associations being correct in System Settings > Applications > File associations. A Reddit user mentioned the following:

>The root of the problem is: KDE does not initialize the XDG file associations file ~/.config/mimeapps.list with its defaults. Instead KDE relies on its own launch executable. Since Thunderbird / GTK apps parse that file to get defaults it shows a random app that supports opening PDF files.

>A quick workaround to solve this is forcing KDE to generate the entry for PDF files. You can do that by changing file association order to something different than the default applying it and then turning the ordering back to Okular-first in System Settings -> File Associations.

>It is an oddity left from KDE4 days. It allows people to try out KDE without ruining GTK based desktop file associations but causes problems like this when GTK apps are used under KDE desktop. (https://www.reddit.com/r/kde/comments/pnnlga/kde_system_handler_does_not_offer_okular_as_an/hcri0t2/?utm_source=reddit&utm_medium=web2x&context=3)

After doing the workaround mentioned above, the files are opening (through the downloads menu of Firefox) in the correct applications.

STEPS TO REPRODUCE
1. Open Firefox;
2. Download a PNG, PDF or JPG file;
3. Click in the downloads menu and open the file.


OBSERVED RESULT
The wrong app will open.

EXPECTED RESULT
The files opening in the right programs.

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 21.04
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2
Kernel Version: 5.11.0-34-generic
OS Type: 64-bit
Graphics Platform: X11
Processors: 8 × Intel® Core™ i5-8265U CPU @ 1.60GHz
Memory: 15,5 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620

ADDITIONAL INFORMATION
This happens in Ubuntu and in Neon. For reasons that are unknown to me, this doesn't happen in Fedora.
Comment 1 61kylyqt 2021-09-14 04:19:06 UTC
Created attachment 141534 [details]
PDFs opening in GIMP, despite Okular being the preferred app

PDFs opening in GIMP, despite Okular being the preferred app according with the following comment: https://bugzilla.mozilla.org/show_bug.cgi?id=1713541#c11
Comment 2 61kylyqt 2021-09-14 04:20:18 UTC
Ops, the blockquote got messed up.

>The root of the problem is: KDE does not initialize the XDG file associations file ~/.config/mimeapps.list with its defaults. Instead KDE relies on its own launch executable. Since Thunderbird / GTK apps parse that file to get defaults it shows a random app that supports opening PDF files.
>
>A quick workaround to solve this is forcing KDE to generate the entry for PDF files. You can do that by changing file association order to something different than the default applying it and then turning the ordering back to Okular-first in System Settings -> File Associations.
>
>It is an oddity left from KDE4 days. It allows people to try out KDE without ruining GTK based desktop file associations but causes problems like this when GTK apps are used under KDE desktop.
Comment 3 David Edmundson 2021-09-14 10:13:53 UTC
>>The root of the problem is: KDE does not initialize the XDG file associations file ~/.config/mimeapps.list with its defaults. Instead KDE relies on its own launch executable. Since Thunderbird / GTK apps parse that file to get defaults it shows a random app that supports opening PDF files.

That's completely untrue. 
Why do you think that?
Comment 4 61kylyqt 2021-09-15 05:07:33 UTC
As I said before, this is a quote from a Reddit comment that I posted in hopes that this bug might get solved.
Comment 5 Bug Janitor Service 2021-09-30 04:35:46 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 61kylyqt 2021-10-01 15:56:11 UTC
._. But I already provided the info.
Comment 7 Bug Janitor Service 2021-10-16 04:35:27 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 8 David Edmundson 2021-10-16 22:46:02 UTC
>But I already provided the info.

I am still unclear what is supposed to be wrong our side.