Getting around recently used files in gnome/ubuntu/gedit/geany/…

If like me and lots of users you are tired of the recently used files “feature” in the open/save dialogs of gtk applications, I’ve found a small work around.

The problem

When using a text editor such as gedit when you use the open file dialog it will default in the “Recently used” places, this could be a nice feature for some users, but it can not be changed to default to a folder, and it’s a broken feature. It’s broken because it will display all sorts of craps, for example it will display movie files, or image files, that can’t even be opened by a text editor, and furthermore in my case it will display hundreds of index.htm files, or README or things like that, and I would have to open them all one by one to find the one I want (Yes, it doesn’t even display folder names).

Workaround – works on Ubuntu 12.10

As far as I know there is no way to disable this, so I’ve decided to work with it and bend it to my needs :) It will now display only a few selected folders (my “favorites” folders), which suits me (if only it could display by default my favorites folders from Nautilus….) and it can not be modified.

Capture du 2013-01-24 13:52:43

I take no responsibility for any damage done to your computer !

First open a terminal (Alt+F2 > gnome-terminal) and move to the .local/share directory:

cd ~/.local/share

Edit the recently-used.xbel with a text editor

geany recently-used.xbel

This file contains all the recently used file in a XML format, just replace everything with that:

<?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/YOUR_USERNAME" added="2013-01-01T00:00:00Z" modified="2013-01-01T00:00:00Z" visited="2013-01-01T00:00:00Z">
    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="inode/directory"/>
      </metadata>
    </info>
  </bookmark>
</xbel>

Change YOUR_USERNAME by your user name, this will display a link to your home folder. You can copy/paste the lines from <bookmark to </bookmark> and change the folder to add as many folder as you like.

Now we will need to forbid modifications on this file, save the file, close the editor and back to terminal type:

sudo chattr +i recently-used.xbel

In order to see changes restart your computer or enter command:

zeitgeist-daemon --replace

Now when you open a file dialog it should display your selected folders. If you want to revert or re-edit the file just use command

sudo chattr -i recently-used.xbel

 

Problems

  • The save file dialog seems to be a bit tricky, it does display some of the selected folders, but not all, and it will also display some others too, I don’t know why yet
  • I’ve only tested this solution for a few hours, I will update this post if I encounter other problems/solutions

Comments are closed.