Search code examples
linuxcentossalt-project

Remote creation of Custom actions in Thunar


I'm using Thunar as file browser for a linux network composed of 100 CentOS 7.2 machines. We are managing the installation of those workstations with a PXE server and SaltStack installation. I need to create those custom actions during the installation.

Currently, Thunar is installed on every workstations, the script is available on a share but I need to create the custom action on each machine. Open Thunar, Edit > Create custom actions and it launches my script in xterm for the selected folder:

xterm -e "/path/to/my/script.sh %f"

Is there a way to create Thunar's custom actions from command lines or by editing a file so that I will be able to launch them through Salt cmd.run?

Thanks for your help.


Solution

  • I've found out that those Custom actions are store in this file:

    cat ~/.config/Thunar/uca.xml 
    

    Here is an example of the syntaxe:

    <?xml encoding="UTF-8" version="1.0"?>
    <actions>
    <action>
        <icon>script.png</icon>
        <name>My custom action</name>
        <unique-id>1479309009025049-2</unique-id>
        <command>xterm -e &quot;/path/to/my/script.sh %f&quot;</command>
        <patterns>*</patterns>
        <startup-notify/>
        <directories/>
        <audio-files/>
        <image-files/>
        <other-files/>
        <text-files/>
        <video-files/>
    </action>
    </actions>
    

    That way, I can create this template file and copy it in the user folder.