I am aware that in distributions such as Ubuntu it is very easy to clear recent files, but I have three questions about recent files:
I am sitting on Arch Linux with i3 window manager.
It is the desktop environment that does handle recent files (KDE uses baloo for example, Nautilus uses ~/.local/share/recently-used.xbel
). There is no uniform way of handling recent files.
Potential candidates for what you are looking for are:
st_atime
field from the struct stat
structure written by the stat
system call, but it would show any access, not only when a user opens the file and is not guaranteed to be available for the filesystem (see the noatime
option when mounting a filesystem, in the Filesystem Independent Mount Options)Your best bet is to write you own library which would then use KDE/GNOME libraries (or any other backend, if there are other desktop environments which implement these features) to get the data.
The i3 window manager does not implement this however since it does only handle window management and almost nothing else.