Places | Recent Files not opening correctly

I'm using Mate 24.04.

I have a problem with recent files:

  1. Click on Places to get drop down.
  2. Select a file in Recent Documents
  3. Usually, the text editor Geany opens, but sometimes another wrong app opens
  4. Some file extensions open correctly, but not all. PDFs open with Geany, for example. This seems to change over time because PDFs used to work while others didn't.

Files open properly from Caja. xdg-mime query filetype returns application/pdf for a PDF file. Update: But query default returns nothing.

This duplicates two previous questions from me. One didn't get a good answer, and the other answered one of my questions.

What do I change to fix this?

I'd suggest to try a simple method first. I.e. right click on a file of desired type, say, .pdf. Select menu entry Open with > Another Application and select the proper application. Ensure that Remember this application for ... files checkbox is selected and press Open button.

Good luck!

4 Likes

Why use Recent Files to open files?

Just go to the directory with the file and open from there.

The files open fine from inside Caja. It is the Recent Files that won't open correctly. I did check and see precisely what you have for PDF files that Atril is the viewer to open.

That requires multiple clicks to open Caja and drill down to the directory. Recent files is two clicks.

With Thunar already open, it takes me 2 clicks.

But if a person is looking to open a recent file that he edits frequently, Recent Files would fit the bill.

This is still a problem. When I try to open a newly downloaded .dep, it opens the text editor. The same is true for a .pdf and .md.

The correct file opens in Caja, so it appears not to be a mime association but something with Recent Files.

Recent files are in ~/.local/share/recently-used.xbel I opened a pdf, this is the contents of the file (associated with the Atril Document Viewer):

<?xml version="1.0" encoding="UTF-8"?>
<xbel version="1.0"
      xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"
      xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"
>
  <bookmark href="file:///home/user/share/pdf/2019_smartwatch.pdf" added="2025-03-27T19:38:19.420531Z" modified="2025-03-27T19:38:39.909964Z" visited="2025-03-27T19:38:19.420531Z">
    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="application/pdf"/>
        <bookmark:applications>
          <bookmark:application name="Atril Document Viewer" exec="&apos;atril %u&apos;" modified="2025-03-27T19:38:39.909963Z" count="2"/>
        </bookmark:applications>
      </metadata>
    </info>
  </bookmark>
user@um24:~/.local/share$ cat recently-used.xbel
1 Like

My info for a pdf:

<info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="application/octet-stream"/>
        <bookmark:applications>
          <bookmark:application name="xdg-desktop-portal-gtk" exec="&apos;gio open %u&apos;" modified="2025-03-25T02:32:24.741333Z" count="234"/>
          <bookmark:application name="Atril Document Viewer" exec="&apos;atril %u&apos;" modified="2025-03-22T23:31:06.640179Z" count="8"/>
          <bookmark:application name="Caja" exec="&apos;calibre %U&apos;" modified="2025-03-04T23:44:31.419282Z" count="3"/>
        </bookmark:applications>
      </metadata>
    </info>

But another PDF has:

    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="application/pdf"/>
        <bookmark:applications>
          <bookmark:application name="Atril Document Viewer" exec="&apos;atril %u&apos;" modified="2025-03-04T23:47:54.912309Z" count="3"/>
        </bookmark:applications>
      </metadata>
    </info>

What sets the mime-type? Both files were downloaded using the browser although the 2nd PDF was awhile ago.

Update:

I downloaded a PDF. Caja properties show it as an "application/pdf" but opens in Recent as an "octet-stream." Opening it from Caja works, and then opening it from Recent works.

system wide: /usr/share/mime

user specific: ~/.local/share/mime

there is a update-mime-database that updates the cache either in the system or user location. search for update-mime-database for more.

If you edit your file in recent to point only to atril, it should work.

          <bookmark:application name="Atril Document Viewer" exec="&apos;atril %u&apos;" modified="2025-03-22T23:31:06.640179Z" count="8"/>
2 Likes

Thanks for the reponses but I don't understand what I should try. The mime setup should be fine since it works with Caja.

I don't understand what I find about update-mime-database.

What does this mean:

If you edit your file in recent to point only to atril, it should work.

<bookmark:application name="Atril Document Viewer" exec="&apos;atril %u&apos;" modified="2025-03-22T23:31:06.640179Z" count="8"/>

I am a long time software developer but have never gotten into these type of details with mime.