You are not logged in.
Pages: 1
Hey,
Not sure if this is the best place to ask this Q, but I don't know where else I should. I'd like to sort some files in the "Wastebasket" by date (or time) deleted. I know Caja has this feature, but to my understanding Thunar doesn't have something like this. But is there any method I can get this feature in Thunar, perhaps using some addons (if they even exist)? Or any other pointers? Cheers in advance
Offline
Hi.
Technically, it should be possible, as gvfs stores metadata of trashed files in a separate directory ~/.local/share/Trash/info. However, two problems arise: 1) custom columns cannot be added; 2) custom actions are not displayed inside trash:///.
I'm not aware of any such plug-in that would help with sorting trashed file.
Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please!
Offline
Thanks for the reply.
Hmm ok. I've now thought about trying to change the Wastebasket to use Caja, while keeping Thunar for all other normal folders. Do you happen to know how that can be achieved correctly? One hacky method I've tried (which didn't work 100%) is to create a custom laucher which executes the `caja trash:///`, and then give it the waste can icon. It kinda works, but I cannot select icons on my desktop and hover them over the wastebasket icon to delete them....
Offline
Edit
A new column Date Deleted was added in Thunar 4.17.2: https://gitlab.xfce.org/xfce/thunar/-/c … 915f2f3753. So, either grab the source and compile yourself, or proceed to the following solution.
If you don't mind changing the modification timestamps of newly trashed files, this shell script may work for you:
#!/bin/sh
# strash - change mtime of trashed files so they're sortable
# Copyright (C) 2022 Akbarkhon Variskhanov
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this script. If not, see <https://www.gnu.org/licenses/>.
Trash=${XDG_DATA_HOME:=~/.local/share}/Trash
gio monitor trash:/// \
| while read -r location file change
do case $change in
*created)
file=$(gio info -a standard::display-name ${file%:})
file=${file#*standard::display-name: }
while read -r line
do case $line in
DeletionDate=*)
date=${line#*=}
# '-m' changes mtime; '-a' changes atime
touch -md "$date" "${Trash}/files/${file}"
;;
*) continue
esac
done < "${Trash}/info/${file}.trashinfo"
;;
*deleted) :
case
done
You'd need to add the Date Modified column to the list view and sort accordingly.
I thought about many different variations but decided that something working in the background works the best. I have als discovered that it is actually possible to bind it to a custom action, though this requires accessing Trash by its full real path in Thunar, i.e. ~/.local/share/Trash/files, rather than its gvfs path. Restoring mtimes to their previous values is a bit tricky, which is why I did not include this part in the final version.
If you're a bit shy on changing the modification timestamps, you may want to change the access times instead. A brief comment in the code should provide some clarification. In this case, however, you will need to add the Date Accessed column to your list view.
The script should be safe against files that may contain arbitrary white space in their names.
Anyway, a patch that enables sorting by ctime would be the most optimal solution since the trash::deletion-date attribute seems to be equal to it. As far as I know, there is no hidden setting for it.
Edit
This merge requests talks about some Date Deleted column, which I don't have on any of my machines (physical or virtual). Am I missing something?
Nevermind, this has already been added to Thunar 4.17.2 (development release): https://gitlab.xfce.org/xfce/thunar/-/issues/123
Last edited by KBar (2022-07-25 13:05:13)
Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please!
Offline
Pages: 1
[ Generated in 0.012 seconds, 9 queries executed - Memory usage: 532.59 KiB (Peak: 533.44 KiB) ]