Part II. Writing Extensions

This section explains the basic steps required to write an extension for the Thunar File Manager using the C language interface. It is just a short introduction and not meant to provide extensive details about the internal workings of the file manager.

Basic Concepts

Extensions and Providers

Thunar Extensions are shared libraries that extend the basic functionality provided by the Thunar File Manager. An extension exports one or more GObjects, called providers, to Thunar.

Providers implement one or more of the GInterfaces included with the thunarx library. The currently exported interfaces include the ThunarxMenuProvider for adding context menu items to the file views, the ThunarxPropertyPageProvider for adding pages to the file properties dialog, the ThunarxPreferencesProvider for adding items to the preferences section of the main menu, and the ThunarxRenamerProvider for adding renamers to the bulk rename dialog.


Thunar passes file references to the provider using ThunarxFileInfo objects. The ThunarxFileInfo interface provides access to the file information that Thunar has already read - mime type, URI, name, etc. Extensions should use the data from the ThunarxFileInfo rather than reading it themselves, to prevent excessive I/O.

There is exactly one ThunarxFileInfo per file, and it is kept around for as long as Thunar is interested in the file. Extensions can use this information to manage lifecycles of its own data - e.g. when the ThunarxFileInfo goes away, it is safe for the extension to forget any private data for that file.


Most objects created by the extensions need names, e.g. the ThunarxMenuItems returned from the ThunarxMenuProviders. These names must be namespaced with the name of the extension. For example the main item returned from the TexOpenTerminal extension (which can be found in the examples/tex-open-terminal subdirectory of the Thunar distribution) should be called TexOpenTerminal::open-terminal. The namespace must be global among the providers exported by a certain extension.


Thunar extensions are loaded as GTypeModules. This means that all GTypes created by the extension must be registered with the GTypeModule, using thunarx_provider_plugin_register_type() function (or one of the convenience macros like THUNARX_DEFINE_TYPE()) rather than g_type_register_static(). All types exported by an extension must be registered in thunar_extension_initialize().