3

Each time I go to about:support and click on "Open Directory", Firefox opens it with SMPlayer and then mpv/mplayer complains about :

  Playing: /home/sebastien/.mozilla/firefox-esr/empty6/persdict.dat
Failed to recognize file format.
Exiting... (Errors when loading file)

So I've searched "smplayer" in about:preferences#applications but couldn't find it.

I've also searched for "smplayer" in about:config but couldn't find it either.

And finally I've searched in the XDG mimes types definitions :

$ xdg-mime query filetype ~/.mozilla/firefox-esr/empty6/persdict.dat
text/plain
$ xdg-mime query default text/plain
kate.desktop
$ xdg-mime query filetype ~/
inode/directory
$ xdg-mime query default inode/directory
dolphin.desktop

EDIT 0 : Adding a few xdg-open commands :

$ xdg-open ~/.mozilla/firefox-esr/empty6/persdict.dat
Fontconfig warning: ignoring C.UTF-8: not a valid language tag
$ pgrep -af /persdict.dat
32659 /usr/bin/kate -b /home/sebastien/.mozilla/firefox-esr/empty6/persdict.dat
$ xdg-open Documents
Fontconfig warning: ignoring C.UTF-8: not a valid language tag
$ pgrep -af /Documents
8437 /usr/bin/dolphin --icon system-file-manager -caption Dolphin /home/sebastien/Documents

EDIT 1 : inode/directory= entry in ~/.local/share/applications/mimeapps.list :

$ grep inode/directory= ~/.local/share/applications/mimeapps.list
inode/directory=dolphin.desktop;smplayer.desktop;kde4-dolphin.desktop;vlc.desktop;caja-2.desktop;kde4-kfmclient_dir.desktop;kde4-gwenview.desktop;easytag.desktop;nemo.desktop;audacious-qt.desktop;Thunar-folder-handler.desktop;qmmp_cue.desktop;audacious.desktop;kde4-k4dirstat.desktop;pcmanfm.desktop;qmmp_dir.desktop;qmmp_enqueue.desktop;
inode/directory=dolphin.desktop

EDIT 2 : The Dolphin application launcher is not found by Firefox because it's in the kde4 subfolder of /usr/share/applications/ :

$ locate /dolphin.desktop
/usr/share/applications/kde4/dolphin.desktop

Explanation : Firefox couldn't find dolphin.desktop in /usr/share/applications/, therefore it was using the next entry for inode/directory mimetype in ~/.local/share/applications/mimeapps.list file which was smplayer.desktop :

$ grep inode/directory= ~/.local/share/applications/mimeapps.list
inode/directory=dolphin.desktop;smplayer.desktop;kde4-dolphin.desktop;vlc.desktop;caja-2.desktop;kde4-kfmclient_dir.desktop;kde4-gwenview.desktop;easytag.desktop;nemo.desktop;audacious-qt.desktop;Thunar-folder-handler.desktop;qmmp_cue.desktop;audacious.desktop;kde4-k4dirstat.desktop;pcmanfm.desktop;qmmp_dir.desktop;qmmp_enqueue.desktop;
inode/directory=dolphin.desktop

Solution : Thanks to ashvatthama's anwser : To solve this pb., you can type this command :

xdg-mime default kde4-dolphin.desktop inode/directory

and now it works fine :

$ pgrep -af /empty6
29083 dolphin --icon system-file-manager -caption Dolphin /home/sebastien/.mozilla/firefox-esr/empty6

I've seen this bug for years, I'd love to solve it.

Can you help me ?

SebMa
  • 2,081
  • 3
  • 28
  • 38

1 Answers1

3
$ grep inode/directory= ~/.local/share/applications/mimeapps.list
inode/directory=dolphin.desktop;smplayer.desktop;kde4-dolphin.desktop;vlc.desktop;caja-2.desktop;kde4-kfmclient_dir.desktop;kde4-gwenview.desktop;easytag.desktop;nemo.desktop;audacious-qt.desktop;Thunar-folder-handler.desktop;qmmp_cue.desktop;audacious.desktop;kde4-k4dirstat.desktop;pcmanfm.desktop;qmmp_dir.desktop;qmmp_enqueue.desktop;
inode/directory=dolphin.desktop

$ grep inode/directory= /usr/share/applications/mimeinfo.cache
inode/directory=Thunar-folder-handler.desktop;kde4-kid3.desktop;kde4-gwenview.desktop;kde4-dolphin.desktop;kde4-kfmclient_dir.desktop;nautilus.desktop;caja-folder-handler.desktop;audacious-qt.desktop;nautilus-folder-handler.desktop;pcmanfm.desktop;audacious.desktop;baobab.desktop;nemo.desktop;

so what you should do is edit both of these files so that the lines starting with inode/directory say inode/directory=dolphin.desktop and nothing else.

EDIT: subfolders

According to the XDG Desktop Entry specification:

Desktop File ID

Each desktop entry representing an application is identified by its desktop file ID, which is based on its filename.

To determine the ID of a desktop file, make its full path relative to the $XDG_DATA_DIRS component in which the desktop file is installed, remove the "applications/" prefix, and turn '/' into '-'.

For example /usr/share/applications/foo/bar.desktop has the desktop file ID foo-bar.desktop.

so you didn't need to make a symlink from dolphin.desktop to kde4/dolphin.desktop, you could have just specified kde4-dolphin.desktop to xdg-mime etc.

ashvatthama
  • 823
  • 4
  • 11
  • You're right. But the thing is I have multiple desktop environments installed on this PC (KDE,XFCE,LXDE), each of them having their own default file managers. – SebMa Jun 18 '20 at 07:34
  • I see, then at least you should remove the `smplayer.desktop` bit – ashvatthama Jun 18 '20 at 07:35
  • Yes. I was trying to edit it and somehow it was being written by another daemon. Now, the file size is 0 so I'm going to remove it. Now, I've just re-defined the `inode/directory` to `dolphin.desktop` with this command : `xdg-mime default dolphin.desktop inode/directory` – SebMa Jun 18 '20 at 07:37
  • did `xdg-mime default` fix the issue? – ashvatthama Jun 18 '20 at 07:51
  • Yes and No. Yes because firefox does not use SMPlayer anymore but No because it does NOT use Dolphin either. – SebMa Jun 18 '20 at 07:58
  • Can you understand why the first `desktop` application of `inode/directory=` is ignored even though it's present in the `/usr/share/applications/` folder ? – SebMa Jun 18 '20 at 08:02
  • I'm not really sure. I guess 1) there's a cache overriding it (`mimeinfo.cache`) or 2) maybe it chooses the last in the list, instead of the first – ashvatthama Jun 18 '20 at 08:08
  • Take a look at my EDIT2 :) – SebMa Jun 18 '20 at 08:16
  • @SebMa Great to hear you solved it! but I don't think you need the symlink, see the edit to my answer. – ashvatthama Jun 18 '20 at 08:30
  • Great solution :) ! Just removed my symlink and typed `xdg-mime default kde4-dolphin.desktop inode/directory` and now it works fine ! Wish I could upvote your answer a second time but it seems the Stack Exchange application does not allow it :( – SebMa Jun 18 '20 at 08:49