Clear “Recent Items” in Gnome-Shell

When using gnome-shell there isn’t any way to clear your recent items (yet).
There is a way to do it via CLI.

rm ~/.recently-used.xbel
rm ~/.recently-used

After a few second or opening a random file, your recent items are cleared.

Posted in Linux and tagged , , .

14 Comments

  1. after those commands do
    mkdir /home/user/recently-used.xbel
    only a temporary workaround but it’s being worked on

    • Thanks for the add on.
      Making this directory should prevent that Ubuntu creates a new list with recent items.

  2. If you download the AWN dock bar, there is an applet called main menu. It opens like the gnome 2 menu. From there you click on recent documents scroll to the bottom and click clear recent items.

    • Das tut mir leid. Ich habe es aber gerade unter 11.10 und der Gnome Shell nochadmals ausadproadbiert. Hat einadwandadfrei fuitkionnert.Nachadtrag 4.11.: Inzwiadschen habe ich es auf drei veradschieaddeadnen Rechadnern unter 11.04 und 11.10 veradsucht, immer mit Erfolg.

  3. Jason’s comment on the “AWN – Cairo Main Menu” works VERY effectively.

    Was worried that I wasn’t gonna be able to use the GnomeShell regularly because of the Recent Items portion.

    It highlighted the part of my life my gf understands but doesn’t really wanna see either. XD

  4. following script when ran will clear the file

    #!/usr/bin/env python
    import os
    home = os.environ.get(‘HOME’)
    bookmark_path = ‘.local/share/recently-used.xbel’
    from xml.etree.ElementTree import ElementTree
    tree = ElementTree()
    root = tree.parse(os.path.join(home,bookmark_path))
    root.clear()
    tree.write(os.path.join(home,bookmark_path),encoding=”utf8″)
    print “cleared your bookmarks”

  5. delete recently-used.xbel (usually found in ~/.local/share/)
    right click & create new file & rename to ‘recently-used.xbel’
    right click & goto properties of that file,goto permission tab,change Access from ‘Read and write’ to ‘Read-Only’ close the properties window.

  6. hey… the python script does not work…

    #!/usr/bin/env python
    import os
    home = os.environ.get(‘HOME’)
    bookmark_path = ‘.local/share/recently-used.xbel’
    from xml.etree.ElementTree import ElementTree
    tree = ElementTree()
    root = tree.parse(os.path.join(home,bookmark_path))
    root.clear()
    tree.write(os.path.join(home,bookmark_path),encoding=”utf8″)
    print “cleared your bookmarks”

    Traceback (most recent call last):
    File “./clearrecent.py”, line 8, in
    root = tree.parse(os.path.join(home,bookmark_path))
    File “/usr/lib64/python2.7/xml/etree/ElementTree.py”, line 653, in parse
    parser.feed(data)
    File “/usr/lib64/python2.7/xml/etree/ElementTree.py”, line 1624, in feed
    self._raiseerror(v)
    File “/usr/lib64/python2.7/xml/etree/ElementTree.py”, line 1488, in _raiseerror
    raise err
    xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0

  7. Here’s a better way:

    1. Open the looking glass by pressing Alt+F2 and then typing lg

    2. Enter “imports.gi.Gtk.RecentManager.get_default().purge_items()”

    Of course, it would be trivial to write a gnome shell extension that integrates this in some menu.

  8. +1 for Phil’s comment. Much cleaner

    Phil posted:
    More elegantly (in my opinion):
    cat /dev/null > ~/.local/share/recently-used.xbel

  9. *even” More elegantly (in my opinion) i.e. permanent fix:
    rm ~/.local/share/recently-used.xbel
    mkdir ~/.local/share/recently-used.xbel (stops the file being created / repopulated as it’s now a folder!

Leave a Reply