Thunar custom actions

User avatar
lmello
Posts: 218
Joined: 4. Aug 2010, 17:38
Location: Brazil
Contact:

Thunar custom actions

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

Re: Thunar custom actions

Post 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.
Image
Help to make Slackware easier Donate to Salix
User avatar
damNageHack
Posts: 663
Joined: 24. Sep 2009, 17:07

Re: Thunar custom actions

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

Re: Thunar custom actions

Post 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)
User avatar
Dennola4
Posts: 172
Joined: 7. Sep 2010, 18:25
Location: San Diego, CA, USA

Thunar custom actions: Find Files, Root Permissions

Post 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
There are no stupid questions.
User avatar
JRD
Salix Warrior
Posts: 950
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Thunar custom actions

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

Re: Thunar custom actions

Post 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: *
Image
User avatar
Dennola4
Posts: 172
Joined: 7. Sep 2010, 18:25
Location: San Diego, CA, USA

Re: Thunar custom actions

Post 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.
There are no stupid questions.
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: Thunar custom actions

Post by Shador »

JRD wrote:knowing the size of a directory, included children!
Is this any different from the size displayed in the properties dialog?
Image
User avatar
JRD
Salix Warrior
Posts: 950
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Thunar custom actions

Post 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.
Image
Post Reply