Bellow is how I enabled trash for ranger, perhaps other users will find info useful
Ludo Beckers wrote @ Jan 1
>First thing I'm trying to do is cover myself; I can't be trusted with a delete key >that is permanent :-)
>I put this >"map DD shell mv -t /home/myname/.config/ranger/Trash %s"
>in ~/config/ranger/rc.conf
In his commands.py there are 2 commands - imresize & trash - and while first works, the second one doesn't here.
While I was trying to see what causes a problem I found out python tool:
trash-cli
trash-cli trashes files recording the original path, deletion date, and permissions. It uses the same trashcan used by KDE, GNOME, and XFCE, but you can invoke it from the command line (and scripts)
and replaced DELETE keymaping to use it (with selection)
map <DELETE> trash
where trash is defined in commands.py as
----
import subprocess
class trash(Command):
"""
:trash file1 file2 ...
Delete files using trash-cli
"""
def execute(self):
subprocess.call( ['trash-put'] + map(str, self.fm.env.cwd.get_selection()) )
----
restore-trash, trash-list and trash-empty are available to manage trash items.
The awesome thing about this is that it works without X installed, yet if you use it inside X other programs will be able to see trash data.
Since its python code it could be even made into ranger plugin.