Ubuntu – Keyboard shortcut for Thunar custom actions


Is it possible to add keyboard shortcuts to thunars custom actions?
I tried setting the key with mouse-over (the needed option is set in xfce settings) but that do not work for me.

Best Answer

Yes this is possible.

This is an example for the standard custom action "Open Terminal Here":

Open the file /home/username/.config/Thunar/accels.scm

than you have to search for:

;  (gtk_accel_path "<Actions>/ThunarActions/uca-action-1398672656481710-1" "")

uca stands for an custom action and the 1 at the end stands for the first action.

Change this line as follows ( Alt+t is only an example you can chose what you want ):

  (gtk_accel_path "<Actions>/ThunarActions/uca-action-1398672656481710-1" "<Alt>t")

enter image description here

be sure you have removed the ";" at the beginning, to uncomment the line!

To activate the shortcut logout:

xfce4-session-logout --logout

and log in again.

Open Thunar, press Alt+t this should be open the "Open Terminal Here" action.

Edit 1: The pagination of the custom action are not always in a logical order. To find the right ID (unique-id) you can look into the /home/username/.config/Thunar/uca.xml file:

enter image description here

Edit 2: Sometimes the shortcuts stops working for me, for example if an confirmation box from Thunar pops up. The consequence is that the focus from the Thunar window are lost. In order to get it back to work you have to make a right click in the Thunar window.

Edit 3: (This is a hint from a anonymous user, not tested)

To avoid the problems explained under Edit 2, you have to modify the /home/username/.config/Thunar/uca.xml file. First you have to change the Line: sh -c "cd %f; x-terminal-emulator" making the lowercase f to an uppercase F.

Second you have to add following lines:


this is what the code lookes like after the change:

    <name>Open terminal here</name>
    <command>sh -c &quot;cd %F; x-terminal-emulator&quot;</command>

Restart Thunar and you're done.