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 21:37] – [Adding a Custom Action] 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 142: 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 166: 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 175: 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 220: Line 227:
     *  File pattern: *     *  File pattern: *
     * Appearance Conditions: Text files     * Appearance Conditions: Text files
 +
 ---- ----
  
Line 255: Line 263:
     * Appears if selection contains: Video Files     * Appears if selection contains: Video Files
  
-**Note:** You will need to follow the instructions on [[https://github.com/emericg/OpenSubtitlesDownload|OpenSubtitlesDownload]] which requires ''python'' and ''zenity''. 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.+**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 296: 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