How many recent files does an application really need?

A few days ago, Claudio wrote about the time Eog spent saving the filename of a recenlty used image into ~/.recently-used.xbel. The reason: ~/.recently-used.xbel was too big. If I remember correctly, the FileChooser used to have a similar issue in the past.

Going down from 5.8 MiB to 1.8 MiB, through deleting all those items whose files does not exists, seems to be a good improvement. I wanted to go a bit further and I wondered ¿How many recent files does an application really need? (sorry, not that further :-) I do not think more than 10 per application, but let me know if I am wrong.

I wrote my own version of Claudio's program with that matter in mind. And my ~/.recently-used.xbel file went down from 1.2 MiB to 54 KiB. Before to go to the script, let me show you the numbers I got in a computer with less than two month of non intensive use:

gpoo@pendragon:~$ python clean-recently-used.py -v
Summary:
     1 Reproductor de películas Totem
     1 Glade
     4 GNU Image Manipulation Program
     4 Navegador web
     9 Visor de documentos Evince
     9 File Roller
    14 Web Browser
    15 Gnumeric Spreadsheet
    26 gedit
    34 Administrador de archivos
    36 Evince Document Viewer
    52 Totem Movie Player
   292 File Manager
  1151 Eye of GNOME Image Viewer

Whenever I run Eog, it always shows me only the last 5 files I opened before. Why does it need 1146 extra items stored?

Nevermind. The script I wrote is simple. It deletes those files that does not exists (the same strategy used by Claudio's program), but it also deletes those files that are not so recently used, and I got the following numbers:

gpoo@pendragon:~$ python clean-recently-used.py -v
Summary:
     1 Glade
     3 GNU Image Manipulation Program
     4 Navegador web
     8 File Roller
     9 Visor de documentos Evince
    10 Totem Movie Player
    10 Eye of GNOME Image Viewer
    10 Web Browser
    10 Gnumeric Spreadsheet
    12 Evince Document Viewer
    13 Administrador de archivos
    14 gedit
    41 File Manager

Now you can put the script to be executed when you start your session or you can program it as a cron task.

If you are only interested in getting a summary, you can run the script just using the option -v.