How to launch custom scripts from right click menu on caja




In order to create a script to launch it from mouse right click menu on caja you have to create a bash script and put it on : 
/home/user/.config/caja/scripts/
Where you have to replace user with your username
After that make the script executable with:
sudo chmod +x nomescript.sh

A useful script is this one that compress the selected folder and then delete it keeping only the compressed one.
Use it at your own risk


prefix="file://"
string=$(echo $CAJA_SCRIPT_SELECTED_URIS | tr "%20" " " ) #replace %20 with double space
string=$(echo $string | tr " " " " ) #replace double space with single space
#echo "$string" >> a
file_path=$(echo "$string" | grep -oP "^$prefix\K.*") #remove file:// from filename
current_file=$(basename "$file_path") #get the name after the last slash
#echo "$file_path" >> a
#echo "$current_path" >> a
zip -r -j "$current_file" "$current_file" && rm -rf "$current_file" #compress the file and delete the original


Method tested on debian 9 with Mate and Caja filemanager.

        






Comments:

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>