Page 1 of 1
Small attempt to add an option "send to Trash" to the right-click menu in Rox-Filer
Posted: Sun Dec 31, 2023 3:38 pm
by Caramel
This is a small pet to add a line "move2trash" to the right-click menu in rox.
Edit : new version thanks to the advice of @MochiMoppel
To install the pet (after download) click on it. To uninstall it use PKGget
More information : (Edit see the next message for modifications)
This very simple script move2trash is added to /usr/bin
Code: Select all
#/bin/bash
/usr/local/apps/Trash/AppRun $1
It sends the file (or the directory) passed as an argument to the RoxApp Trash
A link to this script is added in every subfolder of /etc/xdg/rox.sourceforge/net/OpenWith.
To add the link in every subfolder I used a simple script like this:
Code: Select all
for i in $(ls -a /etc/xdg/rox.sourceforge.net/OpenWith)
do
if [ ! $i == "." ] ; then
if [ ! $i == ".." ] ; then
ln -s /usr/share/applications/move2trash /etc/xdg/rox.sourceforge.net/OpenWith/$i/move2trash
fi
fi
done
Re: Small attempt to add an option "send to Trash" to the right-click menu in Rox-Filer
Posted: Mon Jan 01, 2024 3:51 am
by MochiMoppel
Caramel wrote: ↑Sun Dec 31, 2023 3:38 pmThis very simple script move2trash is added to /usr/bin
Code: Select all
#/bin/bash
/usr/local/apps/Trash/AppRun $1
It sends the file (or the directory) passed as an argument to the RoxApp Trash
A link to this script is added in every subfolder of /etc/xdg/rox.sourceforge/net/OpenWith.
I don't know EasyOS but I'm pretty sure that you don't need such script or the pet you created.
To add the link in every subfolder I used a simple script like this:
Code: Select all
for i in $(ls -a /etc/xdg/rox.sourceforge.net/OpenWith)
do
if [ ! $i == "." ] ; then
if [ ! $i == ".." ] ; then
ln -s /usr/share/applications/move2trash /etc/xdg/rox.sourceforge.net/OpenWith/$i/move2trash
fi
fi
done
- Instead of symlinking your script you could symlink the Trash application directly, making your script unnecessary
- You don't need to test for "." and ".." created by your ls command when you use the -A option instead of -a. ls will then output the file list without them
- One problem arises when OpenWith contains directories other than mime directories, e.g. ROX Apps. Your script will ignore files outside of mime directories but it will happily put symlinks into other ROX Apps where they certainly don't belong.
Maybe something like this would work better:
Code: Select all
for i in $(ls -A /etc/xdg/rox.sourceforge.net/OpenWith)
do
if [[ $i = .* ]] ; then # if file/folder is hidden. All mime folders are, ROX apps normally are not
ln -s /usr/local/apps/Trash /etc/xdg/rox.sourceforge.net/OpenWith/$i/move2trash
fi
done
Generally I do not recommend to put symlinks to Trash into all mime directories. I know that this is often done, but I think it's wrong. What happens with files for which no mime type directory exists? ROX recognizes generic mime directories like .application. If the symlink is created in such directory all files with mime type application/<whatever> will have "move2trash" in their right click menu.
Re: Small attempt to add an option "send to Trash" to the right-click menu in Rox-Filer
Posted: Mon Jan 01, 2024 7:10 am
by Caramel
@MochiMoppel , thanks for your remarks.
MochiMoppel wrote: ↑Mon Jan 01, 2024 3:51 am
Caramel wrote: ↑Sun Dec 31, 2023 3:38 pmThis very simple script move2trash is added to /usr/bin
Code: Select all
#/bin/bash
/usr/local/apps/Trash/AppRun $1
It sends the file (or the directory) passed as an argument to the RoxApp Trash
A link to this script is added in every subfolder of /etc/xdg/rox.sourceforge/net/OpenWith.
I don't know EasyOS but I'm pretty sure that you don't need such script or the pet you created.
...
- Instead of symlinking your script you could symlink the Trash application directly, making your script unnecessary
I have tested with symlink to the application directly. The files are deleted but the restoration did not work.
The difference is visible in the .Trash directory :
- capture6913.png (26.68 KiB) Viewed 359 times
Left, it's a file deleted with the symlink to Trash, Right it's a file deleted with the symlink to the script
- One problem arises when OpenWith contains directories other than mime directories, e.g. ROX Apps. Your script will ignore files outside of mime directories but it will happily put symlinks into other ROX Apps where they certainly don't belong.
Maybe something like this would work better:
Code: Select all
for i in $(ls -A /etc/xdg/rox.sourceforge.net/OpenWith)
do
if [[ $i = .* ]] ; then # if file/folder is hidden. All mime folders are, ROX apps normally are not
ln -s /usr/local/apps/Trash /etc/xdg/rox.sourceforge.net/OpenWith/$i/move2trash
fi
done
Generally I do not recommend to put symlinks to Trash into all mime directories. I know that this is often done, but I think it's wrong. What happens with files for which no mime type directory exists? ROX recognizes generic mime directories like .application. If the symlink is created in such directory all files with mime type application/<whatever> will have "move2trash" in their right click menu.
I'm not sure I understand. There is no Rox App or simple mime type like .application in /etc/xdg/rox.sourceforge.net/OpenWith in EasyOS 5.6.5
Re: Small attempt to add an option "send to Trash" to the right-click menu in Rox-Filer
Posted: Mon Jan 01, 2024 8:05 am
by MochiMoppel
Caramel wrote: ↑Mon Jan 01, 2024 7:10 amI have tested with symlink to the application directly. The files are deleted but the restoration did not work.
I tested in Bookworm64 and it worked as expected. BW64 has alread links to the Trash app in many mime folders. When I run the script new links - with a different name - are created and they both point to the same Trash ROX app and work the same.
I'm not sure I understand. There is no Rox App or simple mime type like .application in /etc/xdg/rox.sourceforge.net/OpenWith in EasyOS 5.6.5
There are ROX Apps links in BW64, so my remark was meant as a precaution for users who might want to apply your script in other distros.
Directories like .application , .audio etc. do normally not exist and have to be created first. I haven't seen a distro where these directories are present, let alone used. As I said they work as "catch-all" mime folders and are very useful and efficient. The ROX-Filer manual mentions them briefly ("You can use either the complete type (eg `.image_png') or just the media type. ") but doesn't explain clearly the advantage of mime folders with "just the media type" as name.
New version of addTrash
Posted: Mon Jan 01, 2024 8:42 am
by Caramel
@MochiMoppel, i have recreated the pet with your good advices. It's nice to have help
I had made a mistake in understanding an ROX App. I had made the symlnik with the AppRun in the Trash folder and not directly with the Trash folder.