How to hack GTK's "Recently Used" virtual folder

Lots of people hate GTK's new file chooser behaviour, which sets the location to a virtual folder with recently used files unless the app overrides it to something more useful. Some apps don't. It is currently not possible to change this default.

Some people hate this behaviour because they don't want their gran to see all their recently viewed donkey porn when saving a spreadsheet. If I let my gran use my computer I would give her a guest account, so I just hate it because it punches my workflow in the stomach, and stabs it repeatedly in the face while it's down.

The privacy advocates can solve their problem by clearing the file in which recently used files are recorded and making it read-only. That doesn't help me have something that isn't utterly useless as the first thing I see in a file chooser. I looked more closely at the file to see how easy it would be to hard-code it to something useful, like a list of commonly used directories.

The file is ~/.local/share/recently-used.xbel. It's XML, so it's fugly, but reasonably editable. A single bookmark entry looks like this:

<bookmark href="file:///home/username/path/to/some.file.html" added="2012-08-13T23:07:20Z" modified="2012-08-13T23:07:20Z" visited="2012-08-13T23:07:20.868364Z">
        <metadata owner="">
            <mime:mime-type type="text/html"/>
                <bookmark:application name="Firefox" exec="&apos;firefox %u&apos;" modified="2012-08-13T23:07:20Z" count="1"/>

So if you change the path to a directory you want to see in the list, and set the appropriate mimetype, everything should Just Work, right?

Well, yes, actually. It is that simple. Today I learned that directories have a mimetype: inode/directory. I haven't checked what happens if you set the incorrect mimetype; if you do and it's something hilarious, let me know in the comments.

If you opened the file in multiple applications, you'll see multiple applications listed in the application section. This information does not seem to affect which files appear in which apps -- the same list is used everywhere. You can remove the whole section, and the file chooser doesn't seem to care.

So I added some directories I use frequently, removed all the other bookmarks, and made the file read-only. Now I have a sane default. I was considering writing a script to make editing the file more pleasant, but most GTK apps I use sensibly override the default to the most recently used directory, so I don't really need this solution to be that advanced.

(P.S. Please don't comment just to tell me to "use a different window manager", which I've already been doing for years. This is a toolkit issue, and I'm not going to stop using GTK apps because the file chooser is doing something stupid.)

How (not) to sell a vintage sewing machine on Gumtree

Because I like browsing them, and I'm in a... critical mood today.

  1. It would be really helpful if you mentioned the model of the machine. if you don't know enough about sewing machines to know what it is, it would be really helpful if you took photographs of things that may help prospective buyers to identify the model.

    1. The original manual, if you have one, is usually a good bet.
    2. The front of the machine is often informative. That's the side with all the knobs on. You are facing it if the wheely thing is on your right and the needly thing is on your left. The side without the knobs is the back, and is really not very interesting.
    3. If there is a motor, it is almost certainly some random motor from a third-party manufacturer. Nobody cares about it. Lovingly photographing the plaque is a waste of effort. No, that is not the serial or model number of the machine.
    4. Don't pile random junk in front of the machine; you may be obscuring something important.
  2. "Industrial" does not mean "made of iron". Your vintage domestic machine is not "industrial".

  3. The dusty, peeling, rust-encrusted treadle you hauled out of your mouldy garage is probably not a priceless antique worth thousands of rands.