Recently used files

XDG recent file storage specification

class xdg.RecentFiles.RecentFiles[source]
addFile(item, mimetype, groups=None, private=False)[source]

Add a recently used file.

item should be the URI of the file, typically starting with file:///.

deleteFile(item)[source]

Remove a recently used file, by URI, from the list.

getFiles(mimetypes=None, groups=None, limit=0)[source]

Get a list of recently used files.

The parameters can be used to filter by mime types, by group, or to limit the number of items returned. By default, the entire list is returned, except for items marked private.

parse(filename=None)[source]

Parse a list of recently used files.

filename defaults to ~/.recently-used.

write(filename=None)[source]

Write the list of recently used files to disk.

If the instance is already associated with a file, filename can be omitted to save it there again.

class xdg.RecentFiles.RecentFile[source]
URI

The URI of the file; typically starts with file:///.

MimeType

A Mime type, such as ‘text/plain’.

Timestamp

Unix timestamp of when the file was added to the list.

Private

Boolean indicating whether the entry is private, meaning that it will only be shown if it is in a selected group.

Groups

A list of groups this entry belongs to.