UberStudent Forums
http://uberstudent.com/phpBB/

Post Your Thunar Custom Actions
http://uberstudent.com/phpBB/viewtopic.php?f=7&t=1069
Page 1 of 1

Author:  Stephen Ewen [ Sat Nov 07, 2015 5:28 am ]
Post subject:  Post Your Thunar Custom Actions

I sometimes wonder how I ever got along without Thunar Custom Actions. I'm going to post a few of my favorites and hope you will too.

To date, you'll find almost of none of the one's I've posted here anywhere else online. Numerous of them are part of the default UberStudent installation.

Note: for any custom action that contains " and ' characters you need to make these with the custom actions user interface. You cannot make a uca.xml file with those characters, since they have to be encoded for xml.

#######################################################

Basic
Name: Copy Folder Path
Description: Copies the file or folder path to the clipboard so you can avoid "file:///" when pasting in to certain terminals
Command: echo -n %f | xclip -selection c

Appearance Conditions
File Pattern: *
Appears if selection contains: Text Files

#######################################################

Basic
Name: Make Backup Folder
Description: Make a copy of the folder, adding a date-stamp and .bak to it.
Command: cp -r %f %f.$(date --iso).bak

Appearance Conditions
File Pattern: *
Appears if selection contains: Directories

Basic
Name: Make Backup File
Description: Make a copy of the files, adding a date-stamp and .bak to it.
Command: cp --backup=t %f %f.$(date --iso).bak

Appearance Conditions
File Pattern: *
Appears if selection contains: Everything except Directories

NOTE: You'll want to make one for each of these with a different icon.

#######################################################

(I've tried a lot of ways to do this and this one works best BY FAR)

Basic
Name: Send to Printer...
Description: Print the selected file(s)
Command: libreoffice --invisible -p %F

Appearance Conditions
File Pattern: *
Appears if selection contains: Image, Other, Text

#######################################################

(I've tried a lot of ways to do this and this one works by far the best)

Basic
Name: Convert to PDF
Description: Make a PDF version of the selected file(s)
Command: libreoffice --invisible --convert-to pdf %F

Appearance Conditions
File Pattern: [Grab the long string at http://pastebin.com/n3Q0TQNN and put it here, it includes literally every file format supported by libreoffice]
Appears if selection contains: Other, Text

#######################################################

Following are ones developers may find useful.

#######################################################

Basic
Name: New Geany Instance
Description: Open the file(s) in a new instance of geany
Command: geany %F -i

Appearance Conditions
File Pattern: *
Appears if selection contains: Other, Text

#######################################################

Basic
Name: Clipboard URL to wget
Description: Pipes a URL you've copied to your clipboard to wget and downloads the file into the working directory, keeping the terminal open when done so you can read the result
Command: mate-terminal -e "bash -c \"wget $(xclip -o); exec bash\""

Appearance Conditions
File Pattern: *
Appears if selection contains: Directories

Note: in UberStudent 4.3 and above, you can accomplish the above (and better, because the script has checks) by doing the following :

Basic
Name: Clipboard URL to wget
Description: Pipes a URL you've copied to your clipboard to wget and downloads the file into the working directory, keeping the terminal open when done so you can read the result
Command: mate-terminal -e cburl2wget 2>/dev/null

Appearance Conditions
File Pattern: *
Appears if selection contains: Directories

#######################################################

Basic
Name: Install with dpkg
Description: Install with dpkg, inserting your password into the string automatically, and keep the terminal open when done so you can read the result
Command: mate-terminal -e "bash -c \"echo yourpassword | sudo -S dpkg -i %F; exec bash\""

Appearance Conditions
File Pattern: *.deb
Appears if selection contains: Other

Note: this also works with gnome-terminal. Obviously, too, replace yourpassword in the command line with your actual password. If you'd rather input your password each time, use this line: mate-terminal -e "bash -c \"sudo dpkg -i %F; exec bash\""

#######################################################

Basic
Name: Sign with GPG
Description: Sign with GPG and keep the terminal open when done so you can read the result
Command: mate-terminal -e "bash -c \"debsign -k ####### %f; exec bash\""

Appearance Conditions
File Pattern: *
Appears if selection contains: Text

Note: this also works with gnome-terminal. Substitute ####### with your actual signature.

#######################################################

Basic
Name: Run in Terminal
Description: Run the executable file in the terminal and keep it open when done so you can read the result
Command: mate-terminal -e "bash -c \"%f; exec bash\""

Appearance Conditions
File Pattern: *
Appears if selection contains: Other, Text

Note: this also works with gnome-terminal.

#######################################################

Basic
Name: Open Folder as Root
Description: Open the folder as root, inserting your password into the string automatically
Command: bash -c "echo yourpassword | sudo -S thunar %F"

Appearance Conditions
File Pattern: *
Appears if selection contains: Directories

Note: Obviously, replace yourpassword in the command line with your actual password.

#######################################################

Basic
Name: Open File as Root
Description: Open the file as root, inserting your password into the string automatically
Command: bash -c "echo yourpassword | sudo -S geany %F"

Appearance Conditions
File Pattern: *
Appears if selection contains: Text, Other

Note: Obviously, you can use any text editor you want besides geany. Obviously, replace yourpassword in the command line with your actual password.

#######################################################

Basic
Name: Build Debian Package
Description: Build a Debian package in the terminal in the current location and keep the terminal open when done so you can read the result
Command: mate-terminal -e "bash -c \"echo '>'; echo '> Preparing to build a Debian package...'; echo '>'; sleep 1; dpkg-buildpackage -sa; exec bash\""

Appearance Conditions
File Pattern: *
Appears if selection contains: Directory

#######################################################

Basic
Name: Make Executable
Description: Make the selected file executable, while reporting in a terminal the change made
Command: mate-terminal -e "bash -c \"echo '>'; chmod -v +x %F; echo '>'; exec bash\""

Appearance Conditions
File Pattern: *
Appears if selection contains: Text, Other

Note: gnome-terminal works as well.

#######################################################

Basic
Name: Create Symlink
Description: Creates a symbolic link to the selected object
Command: ln -s %f %n.symlink

Appearance Conditions
File Pattern: *
Appears if selection contains: Directories, Text, Audio, Image, Other

#######################################################

Basic
Name: Run as User
Description: Open in a terminal, run as a different user, and keep the terminal open so you can read the result
Command: mate-terminal -e "bash -c \"sudo su yourusername %F; exec bash\""

Appearance Conditions
File Pattern: *
Appears if selection contains: Text, Other

#######################################################

sprunge.us is pastebin without the hassle. With this custom action, you just right click over the file, it uploads it to splunge in a terminal, and then the uploaded file's URL copies to your clipboad and also prints to the terminal screen. You must first install xsel for this to work,

Basic
Name: Upload to sprunge.us
Description: Upload code to sprunge.us
Command: mate-terminal -e "bash -c \"cat %f | curl -F 'sprunge=<-' http://sprunge.us | xclip -selection c; echo; echo '%f was uploaded to:'; echo; xsel --clipboard --output; echo; exec bash\""

Appearance Conditions
File Pattern: *
Appears if selection contains: Text, Other

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/