Bug 436407

Summary: Filetype (mimetype) association not correctly set for apps which use glib/gio to open files
Product: [Applications] systemsettings Reporter: postix <postix>
Component: kcm_filetypesAssignee: David Faure <faure>
Status: RESOLVED DUPLICATE    
Severity: normal CC: nate, plasma-bugs, postix
Priority: NOR Keywords: accessibility, usability
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description postix 2021-04-30 14:43:48 UTC
SUMMARY

At least on Manjaro, there are two tools for setting the association of file types: xdg-open, which wraps kde5-open and gio. The latter is used by the glib, which GTK apps like Dino use. 

In the SystemSettings images like image/jpeg or image/png are linked to Gwenview, which can be verified by
`xdg-mime query default image/jpeg`.
Unfortunately, this does not mean that GTKs follow this setting. 

`gio mime image/png` yields for example
    chromium.desktop
    gimp.desktop
    okularApplication_kimgio.desktop
    org.kde.gwenview.desktop
which means that images are opened in Chromium or Gimp or Okular and if neither of those three are available in Gwenview.

One could change this behaviour by setting `gio mime image/jpeg org.kde.gwenview.desktop`
but would need to do so manually for each mimetype using the terminal. 

IMHO the configuration for mimetype handling should be synchronized between xdg-open (kde5-open) and gio to make it most convenient for the user. The current situation may lead to unexpected results contradicting the settings in SystemSettings.



SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.81.0
Qt Version: 5.15.2
Kernel Version: 5.12.0-1-MANJARO
OS Type: 64-bit
Graphics Platform: X11
Comment 1 Nate Graham 2021-04-30 17:38:30 UTC
It should, but this requires the GTK pieces to fully follow the spec. :) You'll have to go bug them about it!
Comment 2 postix 2021-04-30 20:29:14 UTC
(In reply to Nate Graham from comment #1)
> It should, but this requires the GTK pieces to fully follow the spec. :)
> You'll have to go bug them about it!

You mean I have to file a bug report against glib or gio? 
Can you link me to the spec and specify which part of the spec is not respected? Thanks! ;)
Comment 3 postix 2021-04-30 20:29:55 UTC
And a Happy Birthday, Nate!!!!
Comment 4 Nate Graham 2021-04-30 21:11:43 UTC
I'm afraid I don't know the answers to those questions. But thank you very much!
Comment 5 postix 2021-05-01 11:06:17 UTC
(In reply to Nate Graham from comment #4)
> I'm afraid I don't know the answers to those questions. 

I'm afraid we are going to play ping pong again if I open a bug request somewhere else (like we did for 429348). I may do so, but let's first gather more information. :)
The code for associating mime types is not familiar to me. It would be helpful to include the developers from KDE who are working on it to give us some input. Could you please ping and/or add them to this bug report?

Since GIO is a VFS API [1], KDE Plasma could and maybe should make use of it -- if I see it correctly -- in order to set the mimetype associations for both KDE Plasma/Qt and Gnome/GTK apps.

[1] https://developer.gnome.org/gio/stable/ch01.html
Comment 6 postix 2021-05-30 10:13:52 UTC
Let's continue the discussion over there!

*** This bug has been marked as a duplicate of bug 305136 ***