[Thunar-dev] Trash script
Benedikt Meurer
benedikt.meurer at unix-ag.uni-siegen.de
Tue Feb 21 13:37:30 CET 2006
Stefan Stuhr wrote:
> Thunar doesn't have a trash like other file managers, and it doesn't
> seem like it will get one in time for Thunar 1.0 (I do hope that I'm
> wrong here). As I want to have a trash in my filemanager, I have
> developed a simple trash script - simpletrash.sh (shell script with
> embedded python code; attached to this mail) - with nice PyGTK dialogs,
> that can be used to move files to a trash folder.
>
> The script move files to ~/.Trash/ (which seems to be the same method
> Nautilus uses) and append a number to the end of the filename (before
> the extension) when there are name conflicts (e.g. file.txt >
> file-2.txt). It uses the mv command, as that seems to work better than
> the Python shutil.move method.
>
> If one runs the script without arguments, ~/.Trash/ will be opened in
> Thunar. Otherwise, the arguments are the files that one wants to move to
> the trash.
>
> The following suggestions expect the script to have the filename
> simpletrash.sh, be executable, and in a directory in $PATH.
>
> Suggestions for integration with Xfce and Thunar:
> * Add a launcher to a panel with the script as command. You can
> then drag-drop files from Thunar to the launcher to move them to
> the trash. If you click on the launcher, ~/.Trash/ will be
> opened in Thunar.
> * Give ~/.Trash/ a nice trash emblem in Thunar.
> * Add ~/.Trash/ to the shortcuts pane in Thunar and rename the
> shortcut to Trash (or what you want your trash folder to be
> called).
> * Add a custom action in Thunar with (but without quotes) Name:
> "Move to _Trash" and Command: "simpletrash.sh %F". Check all
> check boxes on the Appearance Conditions tab.
> * If and when Xfdesktop will get support for drag-dropping of
> files onto .desktop files as in Thunar (which executes
> the .desktop file's Exec with the dropped files as arguments),
> you can put the attached trash.desktop file in ~/Desktop/ and
> drop files onto it to move them to the trash.
>
> Be aware that this script only supports ~/.Trash/ as trash folder, and
> that files from other filesystems - removable media included - will be
> moved to ~/.Trash/ if you uses this script with them as arguments. You
> may not want to do that.
>
> There is some (as in three) configuration options for the script, in the
> top of the script after the GPL notice. One can configure the script not
> to show the confirmation dialog or the error dialog.
>
> Use this script at your own risk - any damage caused by this script
> isn't in any way intentional.
I haven't checked the script, as I don't have much spare time ATM, but
support for ~/.Trash/ could be added to Thunar as well. That's pretty
easy. Implementing the trash-spec is way harder.
So if people are happy with ~/.Trash/, I can add that to Thunar for Xfce
4.4.
> Stefan
Benedikt
More information about the Thunar-dev
mailing list