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 [2022/12/11 12:32] – [Download video subtitles] --> periscope is discontinued 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 30: Line 30:
     * **[[#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]]**     * **[[#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 36: 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 140: 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 164: 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 173: 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 218: Line 227:
     *  File pattern: *     *  File pattern: *
     * Appearance Conditions: Text files     * Appearance Conditions: Text files
 +
 ---- ----
  
Line 253: Line 263:
     * Appears if selection contains: Video Files     * Appears if selection contains: Video Files
  
-**Note:** You will need ''OpenSubtitlesDownload''. Get it [[https://github.com/emericg/OpenSubtitlesDownload|here]]. You can tweak the behavior of the script simply by editing with a text editor, the code is all commented, so it is very easy to understand.+**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 294: Line 304:
     * File pattern: *     * File pattern: *
     * Appears if selection contains: any     * 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     * Range: 1-1