You are not logged in.

#1 2017-09-17 11:49:05

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Trashd, a linux bus user service that provides trashing support

Hi,
i'm presenting to you all my latest project: Trashd. It is a C implementation of freedesktop trash specification.
It aims to provide an easy way for file managers/DE to provide trash support in a unified and simple manner.
It is a user bus service; the aim for trashd is to become a standard way to trash files (just like udisks2 is the standard way of mounting filesystems, for example).
It is available in AUR: https://aur.archlinux.org/packages/trashd-git/.
It only depends upon systemd.

In repository is present a small C example too: https://github.com/FedeDP/Trashd/tree/master/Sample.
Link to service interface: https://github.com/FedeDP/Trashd#interface.

Sample methods output:

$ touch bar.txt foo.txt

$ busctl --user call org.trash.trashd /org/trash/trashd org.trash.trashd Trash "as" 2 /home/federico/bar.txt /home/federico/foo.txt
a(sbs) 2 "/home/federico/bar.txt" true "/home/federico/.local/share/Trash/files/bar.txt" "/home/federico/foo.txt" true "/home/federico/.local/share/Trash/files/foo.txt"

$ busctl --user call org.trash.trashd /org/trash/trashd org.trash.trashd Size 
t 8192

$ busctl --user call org.trash.trashd /org/trash/trashd org.trash.trashd List 
as 2 "/home/federico/.local/share/Trash/files/bar.txt" "/home/federico/.local/share/Trash/files/foo.txt"

$ busctl --user call org.trash.trashd /org/trash/trashd org.trash.trashd EraseAll 
a(sbs) 2 "/home/federico/.local/share/Trash/files/bar.txt" true "" "/home/federico/.local/share/Trash/files/foo.txt" true ""

$ busctl --user call org.trash.trashd /org/trash/trashd org.trash.trashd List 
as 0

Benefits of having only one single third-party implementation of trash as a bus service:
* Any file manager can avoid implementing it
* Less code -> less maintenance commitment
* If every file manager uses this service, there won't be any difference regarding to trash while switching file manager
* Given its implementation as a bus user service, it is accessible from any language that has dbus bindings (bash, python, C, ...)

Maybe if anyone of you is developing a file manager, she/he can find this useful (and any feedback will be really appreciated!).
I am open to suggestions/advices regarding Trashd interface, ie: if you (developer) feel any method should be expanded/some method is missing, just open an issue on github.

Have a nice day!

Last edited by nierro (2017-09-17 18:22:21)

Offline

Board footer

Powered by FluxBB