Overview

Writing a thunarx-python extension is a fairly straight-forward process. One simply imports the Thunarx module and creates a class which is derived from a number of the Thunarx module's classes. When an extension derives a class, it becomes a "provider", telling Thunarx to ask it for information. There are several types of providers available for extensions to use: there is MenuProvider, PropertyPageProvider, RenamerProvider, and PreferencePageProvider, all of which will be explained in more detail below. Your class can be derived from multiple providers.

Here are the basic steps:

1. A script is written and installed to the standard python extensions install path

2. Thunar is (re)started and loads the thunarx-python C extension, which in turn loads all python extensions

3. Any python script in the standard python extensions install path that imports the Thunarx module and derives the main class from a Thunarx module class will be loaded

Where to install python extensions

As of thunarx-python 0.3.0, python extensions are installed in $XDG_DATA_DIR/thunarx-python/extensions where $XDG_DATA_DIR could be /usr/share for a global install or ~/.local/share for a local install.

As of thunarx-python 0.5.0, python extensions are loaded in the following order: 1. $XDG_DATA_HOME/thunarx-python/extensions 2. thunar_prefix/share/thunarx-python/extensions 3. $XDG_DATA_DIRS/thunarx-python/extensions 4. THUNARX_EXTENSION_DIR/python (i.e. /usr/lib64/thunarx-3/python)

thunarx-3

As of thunar v1.7.0, thunarx requires Gtk+3 and no longer accepts gtk.Actions. Instead, it expects Thunarx.MenuItems.

python3

As of thunarx-python v0.5.0, thunarx-python can be built to embed python3 instead of python2. It uses the $PYTHON environment variable to determine which library to use.