## <> ## <> ## <> ||<>|| Discussion of this wiki can be found [[http://ubuntuforums.org/showthread.php?t=2012432 | here ]] = Thunar Custom Actions = If you like the Thunar file manager (default in Xubuntu), you will probably love custom actions. These are user-defined commands that act upon selected files in Thunar. Either on their own, or combined with a simple dialog app such as Zenity, these can be very powerful and useful. '''Thunar > Edit > Configure custom actions''' will take you to the dialog for creating and organising your custom actions. However, because this is GUI-oriented, the easiest way to install someone else's custom action is through a bash command. This is a list of a number of custom actions contributed by the Ubuntu community. ffmpeg -i %f 2>&1 | grep -e Stream -e Duration -e Input | zenity --width=800 --height=240 --text-info --title %n == Delete/Bypass Recycle Bin == '''Command:''' {{{ rm -r }}} '''Description:''' Removes the selected file(s) from the disk, bypassing any local Recycle bin. Useful when in samba shares. Requires confirmation for reasons of safety.<
> '''Requires:''' zenity {{{ CONTENT='stock_deleteRemove...zenity --question --title="Remove..." --window-icon="/usr/share/icons/Tango/16x16/actions/edit-delete.png" --text="Do you wish to permanently\nremove the selected file(s)?" ; if [ $? = 0 ] ; then rm -r %F ; fiPermanently remove the selected file(s)*' cat $HOME/.config/Thunar/uca.xml >> newtmp sed 's/<\/actions>//' newfile echo $CONTENT >> newfile mv $HOME/.config/Thunar/uca.xml $HOME/.config/Thunar/uca.xml.bak mv newfile $HOME/.config/Thunar/uca.xml rm newtmp }}} == Create Symlink == '''Command:''' {{{ ln -s }}} '''Description:''' Creates an absolute symbolic link to the selected file in the same folder, which can then be moved or renamed as desired. `man ln` for more info.<
> '''Requires:''' {{{ CONTENT='emblem-symbolic-linkCreate Symlinkln -s %f %n.symlinkCreates a symbolic link to the selected object*' cat $HOME/.config/Thunar/uca.xml >> newtmp sed 's/<\/actions>//' newfile echo $CONTENT >> newfile mv $HOME/.config/Thunar/uca.xml $HOME/.config/Thunar/uca.xml.bak mv newfile $HOME/.config/Thunar/uca.xml rm newtmp }}} == Permanently Remove == '''Command:''' {{{ Xdialog --title "Remove..." --yesno "Do you wish to permanently remove \n %N?" 10 45 && rm -r %F }}} '''Description:''' Permanently remove selected files. Appears if selection contains any files. <
> '''Requires:''' Xdialog <
> {{{ Permanently remove...Xdialog --title "Remove..." --yesno "Do you wish to permanently remove n %N?" 10 45 && rm -r %FPermanently remove selected files* }}} == Join == '''Command:''' {{{ cat %F > joined.txt }}} '''Description:''' Join selected text files. Appears if selection contains text files. <
> '''Requires:''' {{{ Joincat %F > joined.txtJoin selected text files* }}} == View == '''Command:''' {{{ feh %F }}} '''Description:''' View selected images in a slideshow. Appears if selection contains image files. <
> '''Requires:''' feh {{{ Viewfeh %FView selected images in a slideshow*  }}} == Play 15 seconds == '''Command:''' {{{ mplayer %f -really-quiet -endpos 15 }}} '''Description:''' Play a 15 seconds clip of a media file. Appears if selection contains: audio files, video files<
> '''Requires:''' mplayer {{{ Play 15 secondsmplayer %f -really-quiet -endpos 15Play a 15 seconds clip of a media file* }}} == Copy Current Path == '''Command:''' {{{ echo -n %f | xclip -selection "clipboard" }}} '''Description:''' Copies $PATH to clipboard. <
> '''Requires:''' {{{ xclip program to be installed on your system }}} == Open Terminal Here == '''Command:''' {{{ urxvtc -cd %f }}} '''Description:''' Opens terminal in current directory. <
> '''Requires:''' urxvt client {{{ urxvtc -cd %f }}} == Extract Archive Here == '''Command:''' {{{ squeeze -x . %N }}} '''Description:''' Extracts archive to current directory. <
> '''Requires:''' squeeze {{{ squeeze -x . %N }}} == Extract Passworded Archive == '''Command:''' {{{ xarchiver -e %N }}} '''Description:''' Extracts passworded archive to current directory. <
> '''Requires:''' xarchiver {{{ xarchiver -e %N }}} == Estimated Space Usage == '''Command:''' {{{ du -chs --apparent-size %N | zenity --text-info }}} '''Description:''' Estimates disk space usage. <
> '''Requires:''' zenity {{{ du -chs --apparent-size %N | zenity --text-info }}} == Create Archive Here == '''Command:''' {{{ squeeze -n %N }}} '''Description:''' Creates archive in current directory. <
> '''Requires:''' squeeze {{{ squeeze -n %N }}} == Sign Using GnuPG == '''Command:''' {{{ terminal -e "gpg -a -u [user] -b %f" }}} '''Description:''' Signs a file with the user's GPG key. <
> '''Requires:''' gpg {{{ terminal -e "gpg -a -u [user] -b %f" }}} == Encrypt Using GnuPG == '''Command:''' {{{ terminal -e "gpg -e -r [recipient] %f" }}} '''Description:''' Encrypts a file using GPG. <
> '''Requires:''' gpg {{{ terminal -e "gpg -e -r [recipient] %f" }}} == Decrypt GnuPG File == '''Command:''' {{{ terminal -e "gpg -o %n.decrypted -d %f" }}} '''Description:''' Decrypts GnuPG file, appending ".decrypted" to the decrypted filename. <
> '''Requires:''' gpg {{{ terminal -e "gpg -o %n.decrypted -d %f" }}} == Shred and Delete File(s) == '''Command:''' {{{ zenity --question;if [$? = 0];then shred -fuz %F;fi }}} '''Description:''' Shreds and deletes file. <
> '''Requires:''' zenity {{{ zenity --question;if [$? = 0];then shred -fuz %F;fi }}} == Add to iPod == '''Command:''' {{{ gnupod_addsong.pl %F | Xdialog --title "GNUpod - Add song" --no-cancel --tailbox - 24 64 }}} '''Description:''' Adds songs to iPod. Appears if selection contains audio or video files. <
> '''Requires:''' gnupod, Xdialog {{{ Add to Ipodgnupod_addsong.pl %F | Xdialog --title "GNUpod - Add song" --no-cancel --tailbox - 24 64Add songs to Ipod*.mp3;*.m4a;*.mp4 }}} == Open Folder As Root == '''Command:''' {{{ pkexec thunar %f }}} '''Description:''' Opens current folder with root permissions. <
> '''Requires:''' {{{ pkexec thunar %f }}} == Open Text as Root == '''Command:''' {{{ pkexec mousepad %f }}} '''Description:''' Opens selected text file with root permissions. Substitute the name of your editor of choice for "gedit". <
> '''Requires:''' text editor {{{ pkexec mousepad %f }}} == Search Including Hidden Files/Folders == '''Command:''' {{{ catfish --fileman=thunar --hidden --path=%f }}} '''Description:''' Searches entire filesystem. <
> '''Requires:''' catfish {{{ catfish --fileman=thunar --hidden --path=%f }}} == Mount ISO == '''Command:''' {{{ udisksctl loop-setup -f %f }}} '''Description:''' Mounts .iso files. <
> '''Requires:''' {{{ udisksctl loop-setup -f %f }}} == Convert To AVI == '''Command:''' {{{ xfce4-terminal -x ffmpeg -i %f -b 798k -ab 128k %f.avi }}} '''Description:''' Converts video file to .avi. <
> '''Requires:''' ffmpeg {{{ xfce4-terminal -x ffmpeg -i %f -b 798k -ab 128k %f.avi }}} == Add Progress Bar To Copy == '''Command:''' {{{ (for I in $(seq 2); do echo $I; sleep 1; done; cp %F "/destination/folder") | zenity --progress --pulsate --auto-close }}} '''Description:''' Adds progress bar to copy/paste. <
> '''Requires:''' zenity {{{ (for I in $(seq 2); do echo $I; sleep 1; done; cp %F "/destination/folder") | zenity --progress --pulsate --auto-close }}} == Change Multiple File Permissions == '''Command:''' {{{ }}} '''Description:''' Allows user to change file permissions of one or multiple files with small GUI. <
> '''Requires:''' zenity {{{ ans=$(zenity --height=350 --list --text "change files permissions" --checklist --column "pick" --column "options" TRUE "user-read" TRUE "user-write" FALSE "user-exec" FALSE "group-read" FALSE "group-write" FALSE "group-exec" FALSE "all-read" FALSE "all-write" FALSE "all-exec" --separator=":"); if [ "$ans" != "" ]; then searchuserread="user-read"; searchuserwrite="user-write"; searchuserexec="user-exec"; user1="0" ; user2="0" ; user3="0" ; searchgroupread="group-read"; searchgroupwrite="group-write"; searchgroupexec="group-exec"; group1="0" ; group2="0" ; group3="0" ; searchallread="all-read"; searchallwrite="all-write"; searchallexec="all-exec"; all1="0" ; all2="0" ; all3="0" ; case $ans in *"$searchuserread"*) user1="4" ;; esac ; case $ans in *"$searchuserwrite"*) user2="2" ;; esac ; case $ans in *"$searchuserexec"*) user3="1" ;; esac ; case $ans in *"$searchgroupread"*) group1="4" ;; esac ; case $ans in *"$searchgroupwrite"*) group2="2" ;; esac ; case $ans in *"$searchgroupexec"*) group3="1" ;; esac ; case $ans in *"$searchallread"*) all1="4" ;; esac ; case $ans in *"$searchallwrite"*) all2="2" ;; esac ; case $ans in *"$searchallexec"*) all3="1" ;; esac ; u=$(($user1 + $user2 + $user3)) ; g=$(($group1 + $group2 + $group3)) ; a=$(($all1 + $all2 + $all3)) ; result="$u$g$a" ; chmod $result %F || { zenity --error --text="an error occurred!\ncheck if you are allowed\nto change permissions\nof the selected files"; } ; fi }}} == Move Files From Subfolders To Parent Folder == '''Command:''' {{{ find . -mindepth 2 -type f -exec mv "{}" . \; }}} '''Description:''' Moves files from subfolders to parent (current) folder. <
> '''Requires:''' {{{ find . -mindepth 2 -type f -exec mv "{}" . \; }}} == Delete All Empty Folders == '''Command:''' {{{ find . -type d -empty -delete }}} '''Description:''' Deletes all empty folders in current directory. <
> '''Requires:''' {{{ find . -type d -empty -delete }}} == Encrypt/Decrypt using BCrypt == '''Command:''' {{{ }}} '''Description:''' Uses bcrypt to encrypt/decrypt files. <
> '''Requires:''' zenity, bcrypt {{{ zenity --info --title="Impending Bcrypt Operation" --window-icon="/usr/share/pixmaps/keybox.png" --text="There is a bcrypt operation impending. Watch inside the File Manager window to verify that said operation is successful." ; : ; while [ "$?" = "0" ] ; do xterm -e bcrypt %F ; sleep 2 ; zenity --question --title="Success?" --window-icon="/usr/share/pixmaps/keybox.png" --text="Was the bcrypt operation successful?" ; if [ "$?" = "0" ] ; then exit ; fi ; zenity --question --title="Try again?" --window-icon="/usr/share/pixmaps/keybox.png" --text="Would you like to try again?" ; if [ "$?" != "0" ] ; then exit ; fi ; done }}} == Grab Metadata From Media File == '''Command:''' {{{ ffmpeg -i %f 2>&1 | grep -e Stream -e Duration -e Input | zenity --width=800 --height=240 --text-info --title %n }}} '''Description:''' Grabs info from a media (audio/video) file using ffmpeg. <
> '''Requires:''' ffmpeg, zenity {{{ ffmpeg -i %f 2>&1 | grep -e Stream -e Duration -e Input | zenity --width=800 --height=240 --text-info --title %n }}} == Edit Filesystem Metadata == '''Command:''' {{{ eiciel %f }}} '''Description:''' Edit file or folder extended attributes and access control lists <
> '''Requires:''' eiciel {{{ document-properties Extended attributes eiciel %f Edit extended attributes and permissions * }}} == Open anything as Superuser == '''Command:''' {{{ gksudo exo-open %f }}} '''Description:''' Launch any file or folder with superuser privileges <
> {{{ category-show-all Open as superuser gksudo exo-open %f Open file/folder with full privileges * }}} <
> Another good source of custom actions can be found in the [[http://thunar.xfce.org/pwiki/documentation/custom_actions|Thunar wiki]]. ---- Originally posted [[http://ubuntuforums.org/showthread.php?t=435800|The Ubuntu Forums (ubuntuforums.org)]]