where are the files and dirs "recently used" stored?

On my Ubuntu 12.04, all the gnome applications (such as Nautilus, Evince, gedit, firefox) can access "Recently Used" files and directories, when opening files in them.

  1. I wonder where the information about "Recently Used" files and directories is stored? I would like to access the "Recently Used" files and directories from terminal, by reading such information.
  2. KDE and wine applications can't access "Recently Used" files and directories. I wonder why?

Thanks!


Solution 1:

  1. The Recently Used information is stored in a file called recently-used.xbel located under the .local/share directory per user, the full path being:

    ~/.local/share/recently-used.xbel
    

    It contains metadata on the recent files, like what is the application that opened it, or the application that should display it in its history.

    For example, my gedit shows 3 files:

    If I search for gedit in the file, I can surely see 3 "stanzas" because there are 3 files, here's one of them as a sample:

    <bookmark href="file:///path/to/dsasd" added="2014-07-26T19:22:24Z" modified="2014-07-26T21:52:22Z" visited="2014-07-26T19:22:25Z">
    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="text/plain"/>
        <bookmark:groups>
          <bookmark:group>gedit</bookmark:group>
        </bookmark:groups>
        <bookmark:applications>
          <bookmark:application name="gedit" exec="&apos;gedit %u&apos;" modified="2014-07-26T21:52:22Z" count="7"/>
        </bookmark:applications>
      </metadata>
    </info>
    

  2. The recently-used.xbel file is part of the GTK+ toolkit. I tried looking for some documentation on it, but this is the closest I can get:

    • GtkRecentManager - gnu.org
    • GTK+ 3 Reference Manual: GtkRecentManager

    GNOME uses the GTK+ library, while KDE uses the QT library, I assume that's why it doesn't work with KDE. As for wine, I don't know, maybe it's just not designed to work with it.