Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
xfce:thunar:custom-actions [2012/12/04 11:13] – created nick | xfce:thunar:custom-actions [2024/03/29 19:47] (current) – Using dbus-launch seems to be the best way to get proper support for D-Bus services and as few warnings as possible gael | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Custom | + | ~~NOTOC~~ |
+ | {{ : | ||
+ | ====== | ||
- | Thunar allows users to add custom actions to the file and folder context menus (by the use of the '' | + | Thunar allows users to add custom actions to the file and folder context menus (by the use of the '' |
This page serves as an introduction to the **Custom Actions** plugin, and includes a list of useful examples. | This page serves as an introduction to the **Custom Actions** plugin, and includes a list of useful examples. | ||
- | ===== Adding a custom | + | * **[[#Adding a Custom Action|Adding a Custom Action]]** |
+ | * **[[#Using mnemonics to open Custom Actions|Using mnemonics to open Custom Actions]]** | ||
+ | * **Examples** | ||
+ | * **[[#Search files with catfish|Search files with catfish]]** | ||
+ | * **[[#Work with archives (tar, gzip, etc)|Work with archives (tar, gzip, etc)]]** | ||
+ | * **[[# | ||
+ | * **[[# | ||
+ | * **[[#Rotate JPEGs|Rotate JPEGs]]** | ||
+ | * **[[#Open terminal here|Open terminal here]]** | ||
+ | * **[[#Open root terminal here|Open root terminal here]]** | ||
+ | * **[[#Open thunar as root here|Open thunar as root here]]** | ||
+ | * **[[#Edit file as root|Edit file as root]]** | ||
+ | * **[[#Create a symbolic link|Create a symbolic link]]** | ||
+ | * **[[#Create a hardlink|Create a hardlink]]** | ||
+ | * **[[#View disk usage of the current directory|View disk usage of the current directory]]** | ||
+ | * **[[#Open file in terminal text editor|Open file in terminal text editor]]** | ||
+ | * **[[# | ||
+ | * **[[#Change OpenDocument-supported formats|Change OpenDocument-supported formats]]** | ||
+ | * **[[# | ||
+ | * **[[#Rename subtitles easily|Rename subtitles easily]]** | ||
+ | * **[[#Move files into a new folder|Move files into a new folder]]** | ||
+ | * **[[#Create Shared Thumbnails|Create Shared Thumbnails]]** | ||
+ | * **[[#Use 'bulk rename' | ||
+ | * **[[#Trust multiple desktop files at once|Trust multiple desktop files at once]]** | ||
+ | * **[[https:// | ||
- | This section provides a step-by-step introduction to the **Custom Actions** plugin, demonstrating how to add a **Print File** action, which uses xfprint to print text files. We start by opening the **Custom Actions** dialog as explained above. In the dialog, click on the first button in the list of buttons (the one labeled with the '' | + | ---- |
- | On the first page, enter '' | + | ===== Adding a Custom Action ===== |
- | Now, continue with the second page (the {gui> | + | This section provides a step-by-step introduction to the **Custom Actions** plugin, demonstrating how to add a simple action. We start by opening |
- | We want to create | + | <figure " |
+ | {{: | ||
+ | </ | ||
- | That's all. Click **OK** | + | On the first page, enter '' |
- | Now close the **Custom Actions** dialog, select | + | Optionally, you can specify |
- | {{ documentation: | + | < |
- | You can use the [[http:// | + | Always quote shell variable expansions, unless you know why [classical shell programming advice, but it might be useful to recall here] |
- | ===== Examples ===== | + | When a field code appears in quotes, you can generally extract it and concatenate: |
+ | cmd "foo %f bar" (wrong) ->; cmd "foo " | ||
- | Here are a few useful examples of custom actions. Feel free to extend | + | Or you can put its content in a shell variable and use this variable instead: |
+ | cmd "foo %f bar" (wrong) ->; f=%f; cmd "foo $f bar" (correct) | ||
- | ==== Finding files in the current folder ==== | + | In case of multiple arguments, you can safely use a for loop in that way: |
- | * Name: **Search...** | + | |
- | | + | </ |
- | * File pattern: * | + | |
- | * Appears if selection contains: Directories | + | |
- | **Note:** For this action, you'll need to have '' | + | Now, continue with the second page (the {gui> |
+ | We want to create an action that is only applicable to folders, so select the **Folders** options and unselect the options for the other file types. Next you can specify a **File Pattern** to display the action only for text files that match a certain pattern. In the example, we set the file pattern to '' | ||
+ | That's all. Click **OK** to close the **Create Action** dialog. The new action, labeled **Search with Catfish** will appear in the **Custom Actions** list. | ||
+ | Now close the **Custom Actions** dialog, select a folder in Thunar and open the context menu (right-click on the file icon). The newly created **Search with Catfish** action will appear in the context menu, as shown in the screenshot below. | ||
+ | <figure " | ||
+ | {{: | ||
+ | </ | ||
+ | [[|Back to Top]] | ||
+ | ---- | ||
- | ==== Finding files in the current folder with catfish | + | ===== Using mnemonics to open Custom Actions |
- | * Name: **Search files...** | + | |
- | * Command: '' | + | |
- | * File pattern: * | + | |
- | * Appears if selection contains: Directories | + | |
- | **Note:** For this action, | + | When you create a Thunar Custom Action you can set the name with an underscore " |
+ | ---- | ||
+ | ===== Examples ===== | ||
+ | Here are a few useful examples of custom actions. Feel free to extend this list. | ||
- | + | ==== Search | |
- | + | * Name: **Search files in folder** | |
- | ==== Finding | + | * Command: '' |
- | * Name: **Search files inside...** | + | |
- | * Command: '' | + | |
* File pattern: * | * File pattern: * | ||
* Appears if selection contains: Directories | * Appears if selection contains: Directories | ||
Line 61: | Line 94: | ||
**Note:** For this action, you'll need to have '' | **Note:** For this action, you'll need to have '' | ||
- | ==== Working | + | ---- |
+ | |||
+ | ==== Work with archives | ||
* Name: **Extract here (bzip2)** | * Name: **Extract here (bzip2)** | ||
* Command: '' | * Command: '' | ||
Line 77: | Line 112: | ||
* Appears if selection contains: Directories | * Appears if selection contains: Directories | ||
- | **Hint:** You may prefer the [[http://thunar.xfce.org/plugins.html# | + | **Hint:** You may prefer the [[https://docs.xfce.org/xfce/thunar/archive|Thunar Archive Plugin]], which does pretty much the same thing with less manual setup required on your part. It's either included with your distribution (in the case of [[https:// |
- | ==== Playing | + | ---- |
+ | |||
+ | ==== Play/ | ||
* Name: **Play with XMMS** | * Name: **Play with XMMS** | ||
* Command: '' | * Command: '' | ||
* File pattern: * | * File pattern: * | ||
* Appears if selection contains: Directories, | * Appears if selection contains: Directories, | ||
- | |||
* Name: **Enqueue in XMMS** | * Name: **Enqueue in XMMS** | ||
* Command: '' | * Command: '' | ||
Line 92: | Line 128: | ||
**Hint:** Works exactly the same with Audacious. | **Hint:** Works exactly the same with Audacious. | ||
- | ==== Burning an ISO file to a CD ==== | + | ---- |
- | * Name: **Burn with K3B** | + | |
- | * Command: '' | + | |
- | * File pattern: *.iso | + | |
- | * Appears if selection contains: Other Files | + | |
- | + | ||
- | ==== Viewing images ==== | + | |
- | * Name: **View with GQview** | + | |
- | * Command: '' | + | |
- | * File pattern: * | + | |
- | * Appears if selection contains: Directories, | + | |
- | **Note:** This tip also works just as well with GThumb | + | |
- | ==== Converting | + | ==== Convert |
- | * Name: **To JPEG** | + | * Name: **Convert to JPEG** |
* Command: '' | * Command: '' | ||
* File pattern: *.png | * File pattern: *.png | ||
* Appears if selection contains: Image Files | * Appears if selection contains: Image Files | ||
- | **Hint:** '' | + | **Hint:** '' |
+ | ---- | ||
- | + | ==== Rotate | |
- | ==== Losslessly Rotating | + | |
* Name: **Rotate Clockwise** | * Name: **Rotate Clockwise** | ||
- | * Command: '' | + | |
+ | | ||
+ | * Command(counterclockwise): ''< | ||
* File pattern: *.jpg; | * File pattern: *.jpg; | ||
* Appears if selection contains: JPEG Image Files | * Appears if selection contains: JPEG Image Files | ||
- | **Note: | + | **Note: |
- | ==== Opening a terminal ==== | + | ---- |
- | * Name: **Open | + | |
- | * Command: '' | + | ==== Open terminal |
+ | |||
+ | * Name: **Open terminal | ||
+ | * Command | ||
+ | * Command 2: ''< | ||
* File pattern: * | * File pattern: * | ||
- | * Appears if selection contains: | + | * Appears if selection contains: |
- | **Note:** You might need to type '' | + | '' |
- | ==== Opening a root terminal ==== | + | '' |
- | * Name: **Open | + | ---- |
- | * Command: '' | + | |
+ | ==== Open root terminal | ||
+ | * Name: **Open root terminal here** | ||
+ | * Command(1): ''< | ||
+ | * Command(2): '' | ||
* File pattern: * | * File pattern: * | ||
* Appears if selection contains: Directories | * Appears if selection contains: Directories | ||
+ | |||
+ | **Note:** Use either pkexec or gksu, depending on what is available for your distro. | ||
**Note:** You should rewrite the command with normal straight quotes. | **Note:** You should rewrite the command with normal straight quotes. | ||
- | ==== Opening a root Thunar | + | ---- |
- | * Name: **Open | + | ==== Open thunar as root here ==== |
- | * Command: '' | + | * Name: **Open |
+ | * Command(1): '' | ||
+ | * Command(2): '' | ||
+ | * Command(3): '' | ||
* File pattern: * | * File pattern: * | ||
* Appears if selection contains: Directories | * Appears if selection contains: Directories | ||
- | ==== Editing | + | **Note:** Some distributions no longer include '' |
+ | |||
+ | ---- | ||
+ | ==== Edit file as root ==== | ||
* Name: **Edit as root** | * Name: **Edit as root** | ||
- | * Command: '' | + | * Command(1): '' |
+ | * Command(2): '' | ||
* File pattern: * | * File pattern: * | ||
* Appears if selection contains: Text files | * Appears if selection contains: Text files | ||
- | **Note:** You'll need to replace put-your-favourite-text-editor-here with your favourite text editor (e.g. mousepad or geany). | + | **Note:** You'll need to replace put-your-favourite-text-editor-here with your favourite text editor (e.g. mousepad or geany). |
+ | ---- | ||
- | ==== Creating | + | ==== Create |
* Name: **Create symlink** | * Name: **Create symlink** | ||
- | * Command: '' | + | * Command: '' |
* File pattern: * | * File pattern: * | ||
* Appears if selection contains: Directories, | * Appears if selection contains: Directories, | ||
- | ==== Saving the selected file/ | + | ---- |
- | For fans of the Windows " | + | |
- | * Name: **Copy Pathname to Clipboard** | + | |
- | * Description: | + | |
- | * Command: '' | + | |
- | * File pattern: * | + | |
- | * Appears if selection contains: //any// | + | |
- | + | ==== Create a hardlink | |
- | + | * Name: **Create hardlink** | |
- | ==== Setting an image as the desktop background | + | * Command: |
- | * Name: **Set as desktop background** | + | |
- | * Command:< | + | |
* File pattern: * | * File pattern: * | ||
- | * Appears if selection contains: | + | * Appears if selection contains: |
- | ==== Viewing the disk usage of the current directory ==== | + | ---- |
+ | ==== View disk usage of the current directory ==== | ||
* Name: **Disk Usage** | * Name: **Disk Usage** | ||
* Command: '' | * Command: '' | ||
Line 183: | Line 221: | ||
**Note:** The idea is to get a visual picture of the current directory and any subdirectories. You could also use fsview or filelight, but the visuals are crisper in baobab. | **Note:** The idea is to get a visual picture of the current directory and any subdirectories. You could also use fsview or filelight, but the visuals are crisper in baobab. | ||
- | ==== Using ' | + | ---- |
- | * Command: | + | ==== Open file in terminal |
+ | * Name: **Open in Terminal** | ||
+ | * Command: | ||
+ | * File pattern: * | ||
+ | * Appearance Conditions: Text files | ||
- | Since nano isn't a GUI app, you must start it in a terminal window. | + | ---- |
- | ==== Comparing | + | ==== Compare |
* Name: **Compare** | * Name: **Compare** | ||
* Command: '' | * Command: '' | ||
Line 194: | Line 236: | ||
* Appears if selection contains: Directories and Text files | * Appears if selection contains: Directories and Text files | ||
- | **Note:** You will need '' | + | **Note:** You will need the '' |
- | ==== Changing OpenOffice.org | + | ---- |
+ | |||
+ | ==== Change OpenDocument-supported formats ==== | ||
**Note:** You will need '' | **Note:** You will need '' | ||
Line 210: | Line 254: | ||
You can go on, try '' | You can go on, try '' | ||
- | ==== Download subtitles | + | |
+ | ---- | ||
+ | |||
+ | ==== Download | ||
* Name: **Download subtitles** | * Name: **Download subtitles** | ||
- | * Command: '' | + | * Command: '' |
* File pattern: * | * File pattern: * | ||
* Appears if selection contains: Video Files | * Appears if selection contains: Video Files | ||
- | **Note:** You will need '' | + | **Note:** You will need to follow the instructions on [[https://github.com/emericg/OpenSubtitlesDownload|OpenSubtitlesDownload]] which requires |
+ | |||
+ | ---- | ||
==== Rename subtitles easily ==== | ==== Rename subtitles easily ==== | ||
* Name: **Rename subtitles** | * Name: **Rename subtitles** | ||
Line 224: | Line 274: | ||
* Appears if selection contains: Video Files, Text Files, Other Files | * Appears if selection contains: Video Files, Text Files, Other Files | ||
- | **Note:** You will need '' | + | **Note:** You will need '' |
- | ==== Resize and email images | + | ---- |
- | | + | |
- | | + | ==== Move files into a new folder |
- | | + | * Name: **Move into new folder** |
- | | + | * Description: |
- | ** Note:** You will need the script here (which I name thunar-resize-sendto and place in /usr/local/bin), " | + | * Command: ''< |
- | /usr/local/bin/thunar-resize-sendto | + | |
- | \\ | + | * Appears if selection contains: |
- | Not sure why this isn't part of Thunar plugins, since it's pretty sweet. Tested on Xubuntu Lucid.\\ | + | |
- | \\ | + | **Note:** You' |
- | **NOTE!:** This uses /tmp/thunar-pics0 & /tmp/thunar-pics1 as temp directories, | + | |
+ | ---- | ||
+ | |||
+ | ==== Create Shared Thumbnails ==== | ||
+ | * Name: **Create shared thumbnails** | ||
+ | * Description: | ||
+ | * Command: ''< | ||
+ | * File pattern: * | ||
+ | * Appears if selection contains: Folders | ||
+ | |||
+ | **Note:** Required to download [[https://raw.githubusercontent.com/SKefalidis/DBusSharedThumbnailRepositoryCreator/ | ||
+ | ---- | ||
+ | ==== Use 'bulk rename' | ||
+ | * Name: **Open | ||
+ | * Description: | ||
+ | * Command: ''< | ||
+ | * File pattern: * | ||
+ | * Appears if selection contains: any | ||
+ | * Range: 1-1 | ||
- | < | + | ---- |
- | # | + | |
- | #input to this is a list of files to send. | + | |
- | # depends on thunar, ImageMagick and Zenity | + | |
- | TMP=/ | + | |
- | LOG=/ | + | |
- | MARKER=/ | + | |
- | SENDTO="/ | + | |
- | SIZES=" | + | |
- | DISCMD=" | + | |
- | # Find unused tmp dir | + | |
- | if [ -e $MARKER ]; then | + | |
- | CUR=$(cat $MARKER) | + | |
- | else | + | |
- | CUR=1 | + | |
- | fi | + | |
- | if [ 1 == $CUR ]; then | + | |
- | CUR=0 | + | |
- | else | + | |
- | CUR=1 | + | |
- | fi | + | |
- | echo " | + | |
- | TEMP=" | + | |
- | mkdir -p $TEMP | + | |
- | rm -rf $TEMP/* | + | |
- | for s in $SIZES; do | + | ==== Trust multiple desktop files at once ==== |
- | if [ -z $COLS ]; then | + | * Name: **Trust Desktop Files** |
- | COLS="$s " | + | * Description: |
- | else | + | * Command: ''< |
- | COLS="$COLS 0 $s" | + | * File pattern: *.desktop |
- | fi | + | * Appears if selection contains: other files |
- | done | + | * Range: 1-1 |
- | SIZE=$($DISCMD $COLS) | + | |
- | echo "CUR=$CUR SIZE=$SIZE" >$LOG | + | |
- | for f in " | + | [[|Back To Top]] |
- | | + | ---- |
- | echo "item ' | + | [[: |
- | convert $f -resize $SIZE " | + | |
- | FILES=" | + | |
- | done | + | |
- | $SENDTO $FILES | + | |
- | </ | + |