As a maintainer I have made some custom actions for Thunar.
All custom actions are defined using the Configure custom actions... dialog in Thunar. It is found in the Edit menu.
All examples will follow the pattern
Only the first example will detail the action of opening the Configure custom action dialog
For ISO writing I have a preference for Mint stick. I am thinking it is because it does 2 two things and does it well. There is several benefits using Mint stick
Install mintstick
package
sudo pacman -Syu mintstick
Open Thunar and navigate to Edit → Configure custom actions...
Click the + add an action
Select a nice icon by clicking the icon e.g.
Click the Appearance Conditions tab
Test it by navigating to a folder containing an ISO. Then right click the ISO and select the new Write to USB option.
Close Mint stick and test selected shortcut e.g. F7.
Opening a terminal in a folder is probably one of the most useful features of the file manager. You can use a named terminal or you can use the exo-open
app to launch the system's terminal defined by Preferred applications. To be able to use this you need the package exo
installed. You can check if it is installed using which exo-open
.
Click + in the custom actions dialog to configure a new action
How do we get it to open in the folder currently open in Thunar? At the bottom of the Basics tab is a list of parameters you can use when executing a command.
In this case we want the current folder to be the location opened in the terminal.
We look at the list and find the %d parameter
%d directory containing the file that is passed in %f
Another parameter is referenced %f and this is exactly what we need
%f the path to the first selected file or directory
So our command will be
Next is shortcut
And icon
Now move to the Appearance Conditions tab
Save the action by clicking OK
Click + in the custom actions dialog to configure a new action
The admin: is a protocol which allows for tasks to be launched with administrative privileges. This is part of the gvfs package (Gnome Virtual File System). We are again using the %d parameter to use the current folder for root actions.
And icon
Now move to the Appearance Conditions tab
Save the action by clicking OK
Click + in the custom actions dialog to configure a new action
The command should be an editor supporting the admin protocol. This is true for xed
and gedit
. We use the %f parameter to pass the full path of the selected file to the editor
And icon
Now move to the Appearance Conditions tab
Save the action by clicking OK
The editor I want to use does not support the admin protocol?
You can use pkexec and add some environment variables - e.g. if you want to launch geany the command could look like this
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY geany %f
This is a work around - and may change in the future - who knows ...
Creating the actions from scratch is a tedious task - if you have many. The easy way is to copy this file to another system.
~/.config/Thunar/uca.xml
You have now learned how you create custom actions in Thunar. I hope you find the guide useful.
You can find inspiration for custom actions in this thread