Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
xfce:thunar:custom-actions [2021/10/11 22:42] – [Create Shared Thumbnails] alexxconsxfce: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 25: Line 25:
     * **[[#Compare selected files/directories|Compare selected files/directories]]**     * **[[#Compare selected files/directories|Compare selected files/directories]]**
     * **[[#Change OpenDocument-supported formats|Change OpenDocument-supported formats]]**     * **[[#Change OpenDocument-supported formats|Change OpenDocument-supported formats]]**
-    * **[[#Download subtitles with periscope|Download subtitles with periscope]]**+    * **[[#Download video subtitles|Download video subtitles]]**
     * **[[#Rename subtitles easily|Rename subtitles easily]]**     * **[[#Rename subtitles easily|Rename subtitles easily]]**
     * **[[#Move files into a new folder|Move files into a new folder]]**     * **[[#Move files into a new folder|Move files into a new folder]]**
     * **[[#Create Shared Thumbnails|Create Shared Thumbnails]]**     * **[[#Create Shared Thumbnails|Create Shared Thumbnails]]**
 +    * **[[#Use 'bulk rename' on a single file|Use 'bulk rename' on a single file]]**
 +    * **[[#Trust multiple desktop files at once|Trust multiple desktop files at once]]**
   * **[[https://help.ubuntu.com/community/ThunarCustomActions|List of assorted custom actions]]** (from Ubuntu documentation)   * **[[https://help.ubuntu.com/community/ThunarCustomActions|List of assorted custom actions]]** (from Ubuntu documentation)
  
Line 35: Line 37:
 ===== Adding a Custom Action ===== ===== Adding a Custom Action =====
  
-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 ''+''). The **Create Action** dialog will appear, as shown in the screenshot below.+This section provides a step-by-step introduction to the **Custom Actions** plugin, demonstrating how to add a simple action. 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 ''+''). The **Create Action** dialog will appear, as shown in the screenshot below.
  
 <figure "Create Action Dialog"> <figure "Create Action Dialog">
-{{:xfce:thunar:uca-create.png?nolink&|}}+{{:xfce:thunar:uca-create.png|}}
 </figure> </figure>
  
-On the first page, enter ''Search with Catfish'' in {gui>Name:} and ''search'' in {gui>Description:} Enter ''catfish %f'' for the {gui>Command:} (the ''%f'' will be replaced with the path to the selected file, as explained in the dialog), and select an icon by clicking {gui>Icon:} (in the screenshot the ''system-search.svg'' icon was used). +On the first page, enter ''Create symlink'' in {gui>Name:} Enter ''ln -Ts %f %n" (link)"'' for the {gui>Command:} (the ''%f'' will be replaced with the path to the selected file, as explained in the dialog), and select an icon by clicking {gui>Icon:} (in the screenshot ''emblem-symbolic-link'' was used). 
-r+ 
 +Optionally, you can specify a {gui>Submenu:}, in order to group multiple custom actions into the same menu. 
 <note>Never quote field codes, unless you know why [particularly true if their expansion contains quotes, but not only] <note>Never quote field codes, unless you know why [particularly true if their expansion contains quotes, but not only]
  
Line 108: Line 112:
     * Appears if selection contains: Directories     * Appears if selection contains: Directories
  
-**Hint:** You may prefer the [[http://thunar.xfce.org/plugins.html#thunar-archive-plugin|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 [[http://xubuntu.org/|Xubuntu]]), or available as a separate package (''thunar-archive-plugin'' in Debian Etch). You might also need the ''xarchiver'' or "squeeze" package for things to work quite right.+**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://xubuntu.org/|Xubuntu]]), or available as a separate package (''thunar-archive-plugin'' in Debian Etch). You might also need the ''xarchiver'' or "squeeze" package for things to work quite right.
  
 ---- ----
Line 139: Line 143:
 ==== Rotate JPEGs ==== ==== Rotate JPEGs ====
     * Name: **Rotate Clockwise**     * Name: **Rotate Clockwise**
-    * Command: ''<nowiki>for file in %F; do tempfile=$(mktemp) && jpegtran -copy all -rotate 90 "$file""$tempfile" && mv -f "$tempfile" "$file"rm -"$tempfile"; done</nowiki>''+    *  
 +    * Command: ''<nowiki>for file in %F; do exiftran -i9 "$file"; done</nowiki>'' 
 +    * Command(counterclockwise): ''<nowiki>for file in %Fdo exiftran -i2 "$file"; done</nowiki>''
     * File pattern: *.jpg;*.JPG;*.jpeg;*.JPEG     * File pattern: *.jpg;*.JPG;*.jpeg;*.JPEG
     * Appears if selection contains: JPEG Image Files     * Appears if selection contains: JPEG Image Files
-**Note:** jpegtran is available as part of the libjpeg or libjpeg-progs packages of most distributions. Unlike using "convert", the complicated loop structure is necessary with "jpegtran": "jpegtran -rotate 90 -outfile %F %F" will produce a 0kb file. +**Note:** exiftran is available for most distributions.
- +
-[[https://thelinuxchronicles.blogspot.com/2012/06/thunar-custom-actions-resize-and-rotate.html|Here an example]] how rotation can be scripted with "convert".+
  
 ---- ----
Line 163: Line 167:
 ==== Open root terminal here ==== ==== Open root terminal here ====
     * Name: **Open root terminal here**     * Name: **Open root terminal here**
-    * Command: ''<nowiki>gksu xfce4-terminal --default-working-directory=%f</nowiki>''+    * Command(1): ''<nowiki>pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY dbus-launch xfce4-terminal --default-working-directory=%f</nowiki>'' 
 +    * Command(2): ''<nowiki>gksu xfce4-terminal --default-working-directory=%f</nowiki>''
     * 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.
Line 172: Line 179:
 ==== Open thunar as root here ==== ==== Open thunar as root here ====
     * Name: **Open thunar as root here**     * Name: **Open thunar as root here**
-    * Command: ''gksu thunar %f''+    * Command(1): ''pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY dbus-launch thunar %f'' 
 +    * Command(2): ''thunar admin:/''''/''''/%f'' 
 +    * Command(3): ''gksu thunar %f''
     * File pattern: *     * File pattern: *
     * Appears if selection contains: Directories     * Appears if selection contains: Directories
  
-**Note:** Some distributions no longer include ''gksu''. Use ''pkexec'' instead.+**Note:** Some distributions no longer include ''gksu''. Use ''pkexec'' or the ''admin'' interface instead.
  
 ---- ----
 ==== Edit file as root ==== ==== Edit file as root ====
     * Name: **Edit as root**     * Name: **Edit as root**
-    * Command: ''gksu put-your-favourite-text-editor-here %f''+    * Command(1): ''pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY dbus-launch put-your-favourite-text-editor-here %f'' 
 +    * Command(2): ''gksu put-your-favourite-text-editor-here %f''
     * File pattern: *     * File pattern: *
     * Appears if selection contains: Text files     * Appears if selection contains: Text files
Line 217: Line 227:
     *  File pattern: *     *  File pattern: *
     * Appearance Conditions: Text files     * Appearance Conditions: Text files
 +
 ---- ----
  
Line 246: Line 257:
 ---- ----
  
-==== Download subtitles with periscope ====+==== Download video subtitles ====
     * Name: **Download subtitles**     * Name: **Download subtitles**
-    * Command: ''<nowiki>periscope -l en %F && zenity --info --title "Done" --text "Subtitles downloaded successfully" || zenity --error --title "Error" --text "Subtitles not downloaded successfully"</nowiki>''+    * Command: ''<nowiki>~/.local/bin/OpenSubtitlesDownload.py --gui=gnome %F</nowiki>''
     * File pattern: *     * File pattern: *
     * Appears if selection contains: Video Files     * Appears if selection contains: Video Files
  
-**Note:** You will need ''python-periscope'' package. Get it [[http://code.google.com/p/periscope/|here]]. You'll also need ''zenity'' package. This command will try to get the English subtitles, change ''-l en'' to something else (''fr'', ''de'', ''pt-br'', ...). You should rewrite the command with normal straight quotes.+**Note:** You will need to follow the instructions on [[https://github.com/emericg/OpenSubtitlesDownload|OpenSubtitlesDownload]] which requires ''python'' and ''zenity'' (check the link for a complete list of requirements). You can tweak the behavior of the python script simply by editing with a text editor, the code is all commented, so it is very easy to understand.
  
 ---- ----
Line 286: Line 297:
  
 **Note:** Required to download [[https://raw.githubusercontent.com/SKefalidis/DBusSharedThumbnailRepositoryCreator/main/sharedx.sh|this script]] and store it locally. Requires ''python3'' and ''realpath''. **Note:** Required to download [[https://raw.githubusercontent.com/SKefalidis/DBusSharedThumbnailRepositoryCreator/main/sharedx.sh|this script]] and store it locally. Requires ''python3'' and ''realpath''.
 +----
 +==== Use 'bulk rename' on a single file ====
 +    * Name: **Open in bulk renamer**
 +    * Description: Opens the bulk renamer for a single file
 +    * Command: ''<nowiki>thunar --bulk-rename %f</nowiki>''
 +    * File pattern: *
 +    * Appears if selection contains: any
 +    * Range: 1-1
 +
 +----
  
 +==== Trust multiple desktop files at once ====
 +    * Name: **Trust Desktop Files**
 +    * Description: Sets gvfs checksum and +x flag for all selected *.desktop files
 +    * Command: ''<nowiki>for f in %F; do sha256sum "$f" | awk '{print $1}' | xargs gio set "$f" metadata::xfce-exe-checksum && chmod +x "$f"; done</nowiki>''
 +    * File pattern: *.desktop
 +    * Appears if selection contains: other files
 +    * Range: 1-1
  
 [[|Back To Top]] [[|Back To Top]]
 ---- ----
 [[:xfce:thunar:|Back to Thunar documentation page]] [[:xfce:thunar:|Back to Thunar documentation page]]