cosmic-files icon indicating copy to clipboard operation
cosmic-files copied to clipboard

Use ~/.local/share/Trash/files/ on linux?

Open leb-kuchen opened this issue 1 year ago • 4 comments

I was wondering, what would speak against using this folder, since it preserves metadata.

leb-kuchen avatar Mar 16 '24 22:03 leb-kuchen

Are you referring to the same issue as in #66 ?

I've wondered about watching XDG_DATA_HOME/Trash for changes while researching how to fix that issue as well. It turns out that the trash isn't so clean and tidy that only one folder can be monitored for changes.

The trash in terms of the Freedesktop spec is closer to a virtual file system that may consist of multiple folders across mount points. This is to avoid copying files across mount files when trashed which may be expensive. There may be a global trash folder in the top directory of a mount to support cross mount trashing. There may also be .Trash-$(uid) folders in the top dir of a mount if the global trash is supported but invalid in some way.

So, XDG_DATA_HOME/Trash is the "home trash" folder, but there may be others that need to be watched as well. I would really like to fix this issue so I've thought about the trash a lot. :joy_cat: Maybe soon. Finding the trash directories is a bigger hassle than I imagined. trash-rs implements it by calling the getmnt series of functions. However, these functions are not thread safe and therefore scary to a newbie like myself. trash-cli actually had segfaults a while back due to the same functions.

joshuamegnauth54 avatar Mar 18 '24 06:03 joshuamegnauth54

Since trash-rs already knows, we should get the trash directory list from there.

jackpot51 avatar Mar 18 '24 13:03 jackpot51

Nautilus shows the deleted timestamp, which I consider to be more useful. I do not know, if trash-rs knows the deleted timestamp( and I currently do not have the time to do research), or you would have to parse the info files for that. @joshuamegnauth54 I am referring to the blank modified field.

leb-kuchen avatar Mar 19 '24 19:03 leb-kuchen

trash-rs does provide the deleted time if we want to show that in the modified column.

jackpot51 avatar Mar 19 '24 19:03 jackpot51