Author Topic: Thunar custom actions  (Read 3639 times)

superwow

  • Posts: 86
  • the Earth has music for those who listen-Santayana
    • View Profile
Thunar custom actions
« on: September 24, 2014, 03:05:15 AM »
Thunar custom actions for anyone interested.

Here's how:
1. open thunar
2. go to Edit > Configure custom actions > add new custom action
3. insert into the "command" field the obvious command below and name the action whatever you want.
NOTE: I have employed a number of bash scripts to do custom actions. Yup, leverage the power of the shell into your right click menu.



These are either my currents or some I have used recently. I have a whole ton which I used in a previous distro, but will have to hunt for them. For now, these are fairly useful though. Bon appetit!



md5 checksum
zenity --info --title="Check md5 for %n" --text="$(md5sum %f)"

show space of file/folder
du -h -c %N | grep total | zenity --text-info

copy path
echo -n %f | xclip -selection "clipboard"

copy with progress bar
(for I in $(seq 2); do echo $I; sleep 1; done; cp %F "/destination/folder") | zenity --progress --pulsate --auto-close

create backup file in same folder
cp --backup=t %f %f.backup

move to parent
find . -mindepth 2 -type f -exec mv "{}" . \;

media metadata vamp
#hehe, this one sucks out metadata and injects it into a zenity screen, if you have zenity
ffmpeg -i %f  2>&1 | grep -e Stream -e Duration -e Input | zenity --width=800 --height=240 --text-info --title %n


create symlink
ln -s

disk space
du -chs --apparent-size %N | zenity --text-info

compare files/folders
meld %F

set as wallpaper
nitrogen --set-auto %f

open terminal here
gksudo 'xfce4-terminal --working-directory %f'

delete but bypass trash
rm -r

join files
cat %F > joined.txt

doc(x) -> odt
unoconv -f odt %F

docs -> pdf
#works on doc(x), xls(x), odt, some others
unoconv -f pdf %F

preview media
mplayer %f -really-quiet -endpos 10

play media
mplayer %F

jpg lossless rotate
for file in %F; do tempfile=$(mktemp); (jpegtran -copy all -rotate 90 $file > $tempfile); mv -f $tempfile $file; rm -f $tempfile; don

pgp sign
xfce4-terminal -e "gpg -a -u [user] -b %f"

mount iso
gksudo mount -o loop -t iso9660 %f /mnt'

convert to avi
xfce4-terminal -x ffmpeg -i %f -b 798k -ab 128k %f.avi



make movie thumbnail
makethumb %F (apperance conditions = video files)
## ##
that command requires a short bash script, here:
###############################################
#!/bin/bash

# put me in ~/bin (or somewhere on the path)
# I need mtn (http://moviethumbnail.sourceforge.net/)
# put that into  ~/bin as well
# and image magick installed
# should work on files and paths with spaces in them

while [ $# -gt 0 ]; do
   
file="$1"
filename="${file%.*}"
extension="${file##*.}"

# mtn 1st try

mtn -i -c 1 -r 1 -t -P -o .${extension%.*}.jpg "$1"
if [ ! -s "$1.jpg" ]
then
   mtn -i -c 1 -r 1 -t -P -Z -o .${extension%.*}.jpg "$1"
fi

#convert (image magick)
convert "$1.jpg" -gravity Center -scale 180^ -extent 120x180 "$1_thumb.jpg"

#remove mtn snap and rename the thumb
mv "$1_thumb.jpg" "$filename.jpg"
rm "$file.jpg"

shift
done
###############################################

VastOne

  •      v-ger
  • Posts: 3964
    • View Profile
    • VSIDO Community
Re: Thunar custom actions
« Reply #1 on: September 24, 2014, 03:12:01 AM »
Wow superwow, that's incredible! Thank you so much for this! I am looking forward to parsing through these and creating some and adding my own. Hopefully we'll get a bunch more people involved and have a really incredible selection.

Thank you again! 8)
VSIDO      VSIDO Twitter     VSIDO FB     VSIDO Google+   

I dev VSIDO

superwow

  • Posts: 86
  • the Earth has music for those who listen-Santayana
    • View Profile
Re: Thunar custom actions
« Reply #2 on: September 24, 2014, 03:15:41 AM »
np VO!

Actually I would like to figure out how to make them all appear in a submenu, like the "Send To" menu in MSW, my favorite component of MSW. As it is, I try to prune them so they all fit in a right click menu. I do not use all these at this moment.

jedi

  • DEFCON 1
  • Posts: 1555
  • Not all those who wander are lost.
    • View Profile
    • NixNut.com
Re: Thunar custom actions
« Reply #3 on: September 24, 2014, 03:16:16 AM »
I'll say W O W as well!!!  This is already an incredible selection!  Good going superwow.   8)
Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous

statmonkey

  • Posts: 330
    • View Profile
Re: Thunar custom actions
« Reply #4 on: September 24, 2014, 03:52:57 AM »
It is a superwow superpost! Some awesome stuff in here tonight guys. Better get busy.

ostrolek

  • Posts: 12
    • View Profile
Re: Thunar custom actions
« Reply #5 on: October 28, 2015, 06:18:40 AM »
Thank you! :)