Thunar – eirenicon llc https://eirenicon.org Working together for success! Sun, 07 Jul 2019 23:54:02 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 https://i0.wp.com/eirenicon.org/wp-content/uploads/2019/03/cropped-eirenicon-1.png?fit=32%2C32&ssl=1 Thunar – eirenicon llc https://eirenicon.org 32 32 61586100 Thunar Custom Actions https://eirenicon.org/knowledge-base/thunar-custom-actions/ Tue, 18 Jun 2019 13:14:13 +0000 http://eirenicon.org/?page_id=1299 The following Thunar Custom Actions represent many that I have used over the years. They come & go based on my current/ use needs. What can I say?

Catfish search:

<strong><em>catfish %f</em></strong>

Print file:

<strong><em>xfprint4 %f</em></strong>

Open Terminal Here:

<strong><em>exo-open --working-directory %f --launch TerminalEmulator</em></strong>

Edit as Root:

<strong><em>pkexec geany %f</em></strong>

Run in Terminal

<strong><em>xfce4-terminal -e %f --hold</em></strong>

Open Root Terminal:

<strong><em>pkexec xfce4-terminal</em></strong>

Replace filename space with dash

<strong><em>for file in %N; do mv "$file" "$(echo "$file" | tr -s ' ' | tr -s '-' | tr -c '[:alnum:][:cntrl:].' '-')"; done</em></strong>

Replace filename underscore with dash

<strong><em>for file in %N; do mv "$file" "$(echo "$file" | tr -s '_' | tr -s ' ' | tr -c '[:alnum:][:cntrl:].' '-')"; done</em></strong>

Open Root Here:

<strong><em>pkexec thunar %f</em></strong>

Edit as root:

<strong><em>pkexec [put-your-favourite-text-editor-here] %f</em></strong>

Open Terminal

<strong><em>xfce4-terminal --working-directory %f</em></strong>

Convert JPG to PNG

<strong><em>convert %F `basename %F .jpg`.png</em></strong>

Convert PNG to PNG

<strong><em>convert %F `basename %F .png`.jpg</em></strong>

Run Virus Scan
clamtk %F

PDF-DJVU & OCR

To make my pdf/ djvu/ ocr Thunar Custom Action functions work, you will need to install a few items that I use. The applications I use include:

  • pdfsandwich– “pdfsandwich generates “sandwich” OCR PDF files, i.e. PDF files which contain only images (but no editable text) will be processed by optical character recognition (OCR) and the text will be added to each page invisibly “behind” the images. pdfsandwich is a command line tool which is supposed to be useful to OCR scanned books or journals. It is able to recognize the page layout even for multi-column text. Essentially, pdfsandwich is a wrapper script which calls the following binaries: convert, unpaper, tesseract, gs, and hocr2pdf (if tesseract < 3.03). It is known to run on Unix systems and has been tested on Linux and MacOS X. It supports parallel processing on multiprocessor systems.” …. to preserve color use” References:
  • pdf2djvu– “It’s a known issue that PDF files containing many images can become horribly large. But there is a simple alternative to the PDF file format: DjVu files which use advance compression algorithms behave very much like their more popular big brother PDF, but convince with a reduced file size. “
  • pdf-to-djvu (script)- Is available in our KB “script” area.

All of the above applications need to be installed on your desktop. Use the recommended process for installing applications on your distriution.

The pdf-to-djvu (script) requires a slightly different process:

  • Download the script from this post by clickling the link (above)
  • Extract the script from the “zip archive”.
  • Copy the resultant script, called “pdf-to-djvu”, to the following directory: /usr/local/bin/ Make certain the script is “executable”.

Once these installations, download, and copy steps are completed, you will need to add two (2) Custom Actions to Thunar. (Note: If you don’t know how to do that the process is described here.)

After you have added these Custom Actions they should be fully functional. If you note any difficulty- simply log out & back in, that should make certain Thunar is reset and able to use your new commands.

Once the above tasks are completed, you will be able to:

  • Convert PDF documents To DJVU (Note: The resultant DJVU documents will be searchable even if the original PDF was not… this only works for English, so far as I know.)
  • Make a non-searchable PDF ‘searchable”. (Note: This only works for English, so far as I know.)

Convert PDF to DJVU:

<strong><em>xfce4-terminal -x pdf-to-djvu %f</em></strong>

Convert DJVU to PDF:

<strong><em>xfce4-terminal -x djvu-to-pdf %f</em></strong>

OCR PDF for Search

<strong><em>xfce4-terminal -x pdfsandwich -rgb %f</em></strong>

OCR DJVU file for Search

<strong><em>xfce4-terminal -x ocrodjvu --engine=tesseract --in-place %f</em></strong>
]]>
1299
Creating an Xfce4 Thunar Custom Action (Tutorial) https://eirenicon.org/knowledge-base/xfce4-thunar-custom-action-tricks/ Thu, 13 Jun 2019 17:17:17 +0000 http://eirenicon.org/?page_id=1190 Image Conversion Function(s)

The following Thunar Custom Actions require that you have imagemagick installed.

Here are the commands for each.

  • To Convert jpg to png; the action command is:
convert %F `basename %F .jpg`.png
  • To Convert png to jpg; the action command is:
convert %F `basename %F .png`.jpg

I have the Appearance conditions set for both identically, see the image below:

Appearance Conditions-Image Conversions
Appearance Conditions-Image Conversions

Making a better looking Custom Action Menu

Because I have a lot of custom actions, and I like them organized, here are a couple of ‘tricks’ to allow for simple grouping & sorting.

To create a separator with a label, simply mimic the following image;

Labelled Separator
Labelled Separator

Set the Appearance Conditions to all check marks. The line is actually the dash from your keyboard.

When you’re done you will be able to do something nicer that I have.

Menu with Actions
Menu with Actions

As for the icons I use, I have a folder (collection) and they are simply set from the Custom Action editor screen. Keep them somewhere so you’ll remember!!!!

]]>
1190