Thunar custom actions

Thunar custom actions

Postby lmello » 15. Oct 2010, 02:05

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.
User avatar
lmello
 
Posts: 218
Joined: 4. Aug 2010, 17:38
Location: Brazil

Re: Thunar custom actions

Postby zAchAry » 15. Oct 2010, 05:09

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.
User avatar
zAchAry
 
Posts: 634
Joined: 11. May 2010, 09:02
Location: Israel

Re: Thunar custom actions

Postby damNageHack » 15. Oct 2010, 07:27

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. :)
User avatar
damNageHack
 
Posts: 663
Joined: 24. Sep 2009, 17:07

Re: Thunar custom actions

Postby witek » 23. Nov 2010, 23:17

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)
User avatar
witek
 
Posts: 207
Joined: 16. Nov 2009, 13:41
Location: Poland.Łódź

Thunar custom actions: Find Files, Root Permissions

Postby Dennola4 » 27. Oct 2011, 13:48

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
There are no stupid questions.
User avatar
Dennola4
 
Posts: 150
Joined: 7. Sep 2010, 18:25
Location: San Diego, CA, USA

Re: Thunar custom actions

Postby JRD » 31. Oct 2011, 11:01

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.
Image
User avatar
JRD
Salix Warrior
 
Posts: 952
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Thunar custom actions

Postby JRD » 31. Oct 2011, 11:09

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: *
Image
User avatar
JRD
Salix Warrior
 
Posts: 952
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Thunar custom actions

Postby Dennola4 » 1. Nov 2011, 04:20

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.
There are no stupid questions.
User avatar
Dennola4
 
Posts: 150
Joined: 7. Sep 2010, 18:25
Location: San Diego, CA, USA

Re: Thunar custom actions

Postby Shador » 1. Nov 2011, 13:31

JRD wrote:knowing the size of a directory, included children!

Is this any different from the size displayed in the properties dialog?
Image
Shador
Salix Warrior
 
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: Thunar custom actions

Postby JRD » 2. Nov 2011, 14:37

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.
Image
User avatar
JRD
Salix Warrior
 
Posts: 952
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Next

Return to Documentation