A Guide to Extensions
How to create extensions for Thunderbird.
An extension is a Thunderbird add-on, that provides additional functionality by adding new user interface elements, alter content, or perform background tasks.
The manifest.json
file
manifest.json
fileThe main configuration file of an extension is called manifest.json
, also referred to as the manifest. Besides defining some of the extension's basic properties like name, description and ID, it also defines how the extension hooks into Thunderbird:
A list of all manifest keys supported by Thunderbird can be found in the following document:
The following manifest keys define basic properties:
manifest_version
: A mandatory key defining the Manifest version used by the extension. Supported versions are2
and3
(since Thunderbird 128). The Manifest defines the basic rules how a WebExtension needs to be crafted and how it can interact with Thunderbird.name
: A mandatory key to set the name of the extension.version
: A mandatory key to define a number that denotes the version of the extension.description
: A brief description of what the extension does.author
: The name of a person or company representing the extension developer.
The browser_specific_settings.gecko
manifest key defines the following properties:
strict_min_version
: Defines the lowest targeted version of Thunderbird.strict_max_version
: Defines the highest targeted version of Thunderbird. It can be set to a specific version or a broader match to limit it to a branch (for example128.*
). Usually only needed if Experiments are included.id
: The id serves as a unique identifier for the extension and is mandatory in order upload an extension to ATN or to be able to install it from an XPI file.
Extension Icons
The icons
manifest key tells Thunderbird the location of icons, which should be used to represent the MailExtension. Thunderbird supports basic image types like PNG files, but also SVG files. Thunderbird uses different file icon sizes in different places and allows registering a dedicated file for each size. The MailExtension will use the standard puzzle icon, if no icons have been defined.
Background Page
The extension's background page is loaded in a hidden window when the add-on is started and can be used to load additional JavaScript files.
The background page specifies the JavaScript files to be loaded:
Defining one or more background scripts directly
Instead of defining a background page, the extension can specify a simple list of JavaScript files. This will auto-generate a background page and then load the JavaScript files.
Options Page
The options_ui
manifest key defines the standard MailExtension options page. The defined page will be displayed in the add-on manager by default.
The appearance of the options page can be configured as follows:
open_in_tab
: Open the options page in a tab instead of inline in the add-on manager.browser_style
: Use default browser styles for the options page (recommended).
An inline options page may look as follows:
User Interface Elements
Some UI elements Thunderbird WebExtensions can use are controlled by manifest keys, for example
browser_action
(renamed toaction
in Manifest v3)compose_action
message_display_action
Further information about these UI elements can be found in the following document:
Permissions
A core principle of the WebExtension technology is the use of permissions, so users can see which areas of Thunderbird an add-on wants to access. Add-on developers can predefine all requested permissions in the permissions
manifest key:
Information about required permissions can be found in the following document:
WebExtension Scripts
All JavaScript files loaded by an extension have access to:
Standard JavaScript methods
WebExtension APIs (see restrictions for content scripts and cloudFile scripts below)
A list of all WebExtension APIs supported by Thunderbird can be found in the following document:
Content Scripts
CloudFile Management Scripts
Experiment APIs
The currently available WebExtension APIs are not yet sufficient, as some areas of Thunderbird are not accessible through these APIs. We are working on improving the situation.
Currently and for the foreseeable future Thunderbird supports Experiment APIs (a.k.a. Experiments), which are WebExtension APIs that are bundled and shipped together with a MailExtension. They interact directly with Thunderbird's internal APIs and allow add-ons to use additional features not yet available via built-in WebExtension APIs.
These additional APIs can be registered in the manifest.json
file by defining an implementation script and a schema file describing the interface:
The use of optional permissions is not supported for the same reason.
If you'd like to learn more about experiments, check out this detailed introduction:
Sharing Experiment APIs
Developers can share and re-use Experiments, if their add-ons have similar needs. Before starting to work on your own Experiment, check if any of the following APIs could already provide the functionality you need. Using them and providing feedback to their developers will help to improve these APIs.
Draft for calendar-related APIs in Thunderbird.
Adds missing functionality to add headers to a newly composed message.
Note: Adding X-
headers is supported by the compose API since Thunderbird 102.
A generic UI extension framework based on iframes registered at fixed extension points. Note: Does not yet fully support Thunderbird Supernova
Load custom CSS files into Thunderbird windows.
Access Thunderbird system preferences.
Show notifications inside Thunderbird.
Permit WebExtensions to perform (time-limited) cleanup tasks after the add-on is disabled or uninstalled.
TCP support based on ArrayBuffers (currently client side only).
Proposing APIs to be included in Thunderbird
Creating a good WebExtension API for Thunderbird is not an easy task. New APIs need to be generic and distinct from other APIs. Their interfaces have to be designed with foresight as we should avoid scenarios, where we have to make backward incompatible changes later because we have missed something.
If you want to propose and maybe collaborate on a new API, the following process is suggested:
Publishing a working implementation, so add-on developers can use it and provide feedback.
Adding a patch to the tracking bug and request review.
Last updated
Was this helpful?