I want to add the script 'compress-pdf' to Thunar custom actions.

The script is the one posted in this answer, made to resize pdfs. It is based on zenity.

It was made for Nautilus, but, as stated there, it 'does not depend on any custom Nautilus variables and can be used with pretty much any file manager out there that supports custom menu actions.'

I have added the script into a text file, made it executable, and added the path to it into Thunar custom actions with the name 'resize pdf'.

enter image description here

But, when right-clicking the selected pdf and running 'resize pdf', I get this error:

enter image description here

Why is that and how to fix it?

(Maybe the zenity script needs indeed adjustment to work in Thunar custom actions?)


The error is on line 150


The variable NAUTILUS_SCRIPT_SELECTED_FILE_PATHS does not exist. You need to replace it by pdf_file defined on line 140.

New line 150:

if [ -z "$pdf_file" ]; then

The adjusted version of the script can be found here.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy