Page 1 of 2

Thunar custom actions

Posted: 15. Oct 2010, 02:05
by lmello
Here's a thread for anyone who wishes to share their Thunar custom actions.

Let me start with a "Print..." for printing text files, pdf files and images without having to open them in your application of choice.

Code: Select all

Name: Print...
Description: Print files
Command: xfprint4 %f or gtklp %F
---
Appearance Conditions
File Pattern: *
+ Text Files
+ Image Files
+ Other Files (for pdf's)
IMHO, gtklp is far more reliable than xfprint4. And it supports Unicode. :)
Gtklp is also capable of printing multiple files at once.

Anyway, if you choose xfprint4, don't forget to adjust your virtual page settings, something like 25 lines per page and 80 chars per line will do. Also check "Force binary printing" if you're dealing with image files.

Re: Thunar custom actions

Posted: 15. Oct 2010, 05:09
by zAchAry
Sometimes I wish that there was a special sub-topic (I'm not sure that it's the correct word), here's what I mean: Board index » General » Thunar custom actions, maybe we should have an index of Thunar custom actions at <http://thunar.xfce.org/index.html>

Thunar Custom actions: md5sum
Thunar Custom actions: feh + Slideshow
"install" option on right click under thunar (by JRD)

Thank you for the tip, lmello.

Re: Thunar custom actions

Posted: 15. Oct 2010, 07:27
by damNageHack
zAchAry wrote:Sometimes I wish that there was a special sub-topic
Why not put all that nice stuff with all the scripts into packages for the repository?
Thanks from me too for these useful contributions. :)

Re: Thunar custom actions

Posted: 23. Nov 2010, 23:17
by witek
I`ve just found this custom actions in Thunar and I must confess I`m impressed. My users require these two:

Code: Select all

Name: Move files
Description: Move files
Command: mv %F `zenity --file-selection --directory`
-----------------------
File pattern *
+ everything
================================

Code: Select all

Name: convert to PDF
Description: converts Postscript to PDF
Command: ps2pdf %f
-----------------------
File pattern *.ps ; *.prn (Wine Postscript Driver)
+ Text Files
+ Other Files (for pdf's)

Thunar custom actions: Find Files, Root Permissions

Posted: 27. Oct 2011, 13:48
by Dennola4
Open Thunar, then Edit > Configure custom actions....

1) Find Files Within Current Directory
1a) Under "Basic" tab --
Name: Catfish
Description: Search including hidden files/folders
Command: catfish --fileman=thunar --hidden --path=%f
Icon: Application Icons > catfish
1b) Under "Appearance Conditions" tab:
File Pattern: *
Appears if selection contains: All Files

2) Open Current Directory with Root Permissions (CAREFUL!!!)
2a) Under "Basic" tab --
Name: #Root Directory
Description: Open Current Directory as Root
Command: gksu thunar %f
Icon: Status Icons > Stock_dialog-warning
2b) Under "Appearance Conditions" tab:
File Pattern: *
Appears if selection contains: Directories

3) Open Selected Text File with Root Permissions (CAREFUL!!!)
3a) Under "Basic" tab --
Name: #Root File
Description: Open Text File as Root
Command: gksu geany %f
Icon: Status Icons > Stock_dialog-warning
3b) Under "Appearance Conditions" tab:
File Pattern: *
Appears if selection contains: Text Files

Now when you right-click during a Thunar session you will see very useful new options in the menu, when applicable.
Enjoy. ;) ;) ;)

- Dennis is New Orleans

Re: Thunar custom actions

Posted: 31. Oct 2011, 11:01
by JRD
Good. Just an advice, replace "gksu thunar %f" and "gksu geany %f" with "gksu xdg-open %f". This way, it's open with the preferred application.

Re: Thunar custom actions

Posted: 31. Oct 2011, 11:09
by JRD
One of mine, to fulfill a missing important function in thunar : knowing the size of a directory, included children!

I did not make it internationalized, so I will wild translate my french in english. I also use a Bash script (means no sh, with bashism). Feel free to write a version that does not depend on bash.

Code: Select all

$ cat $HOME/bin/duElements.sh 
#!/bin/bash
[ -z "$1" ] && exit 1
for i in "${@}"; do
  [ ! -e "$i" ] && exit 1
done
files=("${@}")
tmp=$(mktemp)
if [ ${#} -gt 1 ]; then
  title="Size of selected elements"
  textprogress="Compute the size of the selected elements…"
  textsize="Total size: "
else
  el=$(readlink -fns "$1")
  title="Size of '$el'"
  textprogress="Compute the size of '$el'…"
  textsize="Size of '$el': "
fi
(du -chx "${files[@]}" | tee $tmp | sed 's/.*/./') | zenity --progress --pulsate --auto-close --title="$title" --text="$textprogress" --width=400 || cancel=true
if [ -n "$cancel" ]; then
  rm $tmp
else
  size=$(tail -n1 $tmp | cut -f1)
  rm $tmp
  zenity --info --title="$title" --text="$textsize\n$size"
fi
Then in thunar custom actions:
  • Name: Total Size
  • Description: Compute the size of the selected elements
  • Icon: drive-harddisk
  • Command: $HOME/bin/duElements.sh %F
  • Appearance condition: all ticks, pattern filter: *

Re: Thunar custom actions

Posted: 1. Nov 2011, 04:20
by Dennola4
JRD wrote:Good. Just an advice, replace "gksu thunar %f" and "gksu geany %f" with "gksu xdg-open %f". This way, it's open with the preferred application.
Thanks JRD. Good advice.

Re: Thunar custom actions

Posted: 1. Nov 2011, 13:31
by Shador
JRD wrote:knowing the size of a directory, included children!
Is this any different from the size displayed in the properties dialog?

Re: Thunar custom actions

Posted: 2. Nov 2011, 14:37
by JRD
No it's the same....but only if you select one element.
You cannot know the total size of two folders because the properties dialog is only available if you select only one element.