How can the widget "Transparent Folder view" be modified in order to list recently accessed/used files - not just modified ones?

As said in a previous post, I use that widget in order to have on the desktop a list of recent files. —That is mainly because I have decided to use Krunner as application launcher (by simply typing when desktop has focus!) and to add on desktop a few widgets that provide the features I need from an application launcher: seeing recent files as quickly as possible being one of them.—

The maintainer of this widget (thevladsoft) has very kindly and promptly answered my requests to have the recent files displayed as a list, not just a grid, and to have the list refreshed more often!

In order to achieve a proper list of recent files I had to change a few defaults:
set the widget to display as “location” recentlyused:/files/?limit=34, make the sorting by “date” and in a “descending” order, view mode by “list”, and force refresh of folder:

Although this tool is now very useful to me, I have noticed that it doesn’t in fact show the recently accessed files, but just the recently modified ones!

That is rather odd, because recently accessed/used files is what one expects to see when looking for “recent files” (the kio is called recentlyused after all!), the modified files being just a part of the accessed ones: we can access without modifying but not modify without accessing. Also, other tools that show recent files, namely application launchers, show recently accessed files (for example kicker).

Basically, this widget doesn’t show all the recent files, just the ones modified (or newly created, downloaded, etc).

Dolphin makes the difference between used/accessed and modified files through two different columns: “Accessed” and “Modified”. - The difference can be rather big. For example, reading through many pdf files and trying to find them in a recent files list, they appear only in the “Accessed” column, not in the other, and thus not in the widget:

If one pdf or other appears in the widget, it is just because it was also recently created or downloaded, but not because I have read it recently.

Asking again the maintainer about this, it seems a rather tricky problem. He said that:

this widget is based on an already existing widget of plasma. Things that can be done on Dolphin are not necessarily possible on it. Or it could be, but KDE’s documentation is not very helpful in this sense.
A quick search and some meddling with the code didn’t allow me to implement what you ask

But I hope this is nevertheless possible to implement, given that application launchers do display used recent files rather commonly, based on the option with that very name (recentlyused). It’s not just Dolphin that can do that, but many widgets too.

I cannot read or write code, so my efforts to look at files like contents/config/main.xml in kickoff and this widget’s folder (its folder is named org.kde.desktopcontainment-trans) didn’t lead to anything.

All I could gather, considering the launchers that show recent files by access, is that I see a difference between Kickoff (the default application launcher) and others (Kicker, Onze Menu, Menu X, EQ Application Launcher): Kicker also shows recent locations (that is, it is based on recentlyused:, while the others on recentlyused:/files/. But the difference in sorting is made by a different parameter that I ignore.

Can someone help?

The backend KActivity-Stats (that provides the recently-used and favorites, recent apps etc), does not support real file Accessed date.
It watches the ~/.local/share/recently-used.xbel file for modification or other an app can semantically tell a file have been modified or accessed. That file gets modified by application and they add things to this as they please.

In order to follow better application activity it needs to get integration. Some application have such integration, dolphin, kate (although it might be turned off currently), gwenview and the file-opener /file-save dialog.

Or we would need a file indexer watching your whole filesystem (which is technically unrealistic using inotify and fanotify can’t watch recursively in userspace).

You can open a feature request for okular to report open/accessed files in KRecentDocument or using KActivities::ResourceInstance.

Another way we could fix it would be to integrate KActivity-Stats with KRecentFilesAction through a Dbus call or KRecentFilesAction with KRecentDocument/recentlyused.xbel.

I believe bug 437382 – Recent locations and recent files are broken in Dolphin is relevant here.

I have no problem with Dolphin. My Dolphin is not affected by that bug.

Dolphin perfectly does what I want from it, it lists recently used files if I select “Accessed” column. As far as I can understand, the columns in Dolphin are just sorting differently the same list. The widget clearly has access to that list, but it only sorts it in order of modification, not use/access.

I just want sorting by use/access in that widget, something which kicker and other widgets do too.

I want to know if the Transparent “Folder view widget” can be made to do

  • what Dolphin does (when recentlyused:/files/ are sorted by “Accessed” column)?

  • what Kicker does when “recent files” are selected?

The image posted above clearly shows what the widget can and what it cannot do.

It sorts on the access date of the file on the disk (or more precisely a cache value).

I think recentlyused should expose its data separately from real modified date.

It lists files in recentlyused:/files seemingly sorting by modified date as reported by KActivityStat.

The problem can only be solved if KActivityStat gets more recent data, as applications open files.

I have too many things TODO atm to work on that subject.

Looking more into it I think I was completely wrong. The way the widget shows recent files just adds the condition of listing them in order of their modification: but it’s still the same number of recently accessed files.

Now I understand that recentlyused:/files/ will always show recently accessed files, it’s just that Transparent Folder (like Dolphin’s “Modified” column) will sort in order of their modification or creation.

For something like recentlyused:/files/?limit=35, the last 35 most recently used files (modified by me or not) will be listed by date of change or creation.

All files, under this logic, have a date of modification (or creation), and they can be sorted based on that: but recentlyused:/files/ is anyway the sum of most recent 30 accessed/used files — they are only sorted by date of change. They are taken from the same - specific and adjustable - number of recently accessed files anyway: it’s the same list, same items, in both cases, only sorting differs.

So, after many files have been modified and then others have been just accessed, all the widget needs is to have a long-enough list for it to make visible the accessed-but-not-recently-modified files, as they are listed after the more recently modified.