spaces API
The spaces API allows to manage built-in and custom spaces, and to add buttons for custom spaces to Thunderbird’s spaces toolbar.
Functions
Creates a new space and adds its button to the spaces toolbar.
Parameters
name
(string)
The name to assign to this space. May only contain alphanumeric characters and underscores. Must be unique for this extension.
The properties for the new tab being opened, when the associated button in the spaces toolbar is clicked. Either a string specifiying the default URL, or a SpaceTabProperties object. The URL may point to a WebExtension page or a web page.
Properties of the button in the spaces toolbar for the new space.
get(spaceId)
Retrieves details about the specified space.
Parameters
spaceId
(integer)
The id of the space.
open(spaceId, [windowId])
Opens or switches to the specified space. Throws an exception if the requested space does not exist or was not created by this extension.
Parameters
spaceId
(integer)
The id of the space.
[windowId
]
(integer, optional)
The id of the normal window, where the space should be opened. Defaults to the most recent normal window.
query([queryInfo])
Gets all spaces that have the specified properties, or all spaces if no properties are specified.
Parameters
[queryInfo
]
(object, optional)
[extensionId
]
(string, optional)
Id of the extension which should own the spaces. The
permission is required to be able to match against extension ids.[isBuiltIn
]
(boolean, optional)
Spaces should be default Thunderbird spaces.
[isSelfOwned
]
(boolean, optional)
Spaces should have been created by this extension.
[name
]
(string, optional)
The name of the spaces (names are not unique).
[spaceId
]
(integer, optional)
The id of the space.
remove(spaceId)
Removes the specified space, closes all its tabs and removes its button from the spaces toolbar. Throws an exception if the requested space does not exist or was not created by this extension.
Parameters
spaceId
(integer)
The id of the space.
Updates the specified space. Throws an exception if the requested space does not exist or was not created by this extension.
Parameters
spaceId
(integer)
The id of the space.
The properties for the new tab being opened, when the associated button in the spaces toolbar is clicked. Either a string specifiying the default URL, or a SpaceTabProperties object. The URL may point to a WebExtension page or a web page.
Properties of the button in the spaces toolbar for the specified space Only specified button properties will be updated.
Types
ColorArray
An array of four integers in the range [0,255] that make up the RGBA color. For example, opaque red is [255, 0, 0, 255].
array of integer
Space
object
id
(integer)
The id of the space.
isBuiltIn
(boolean)
Whether this space is one of the default Thunderbird spaces, or an extension space.
isSelfOwned
(boolean)
Whether this space was created by this extension.
name
(string)
The name of the space. Names are unique for a single extension, but different extensions may use the same name.
[extensionId
]
(string, optional)
The id of the extension which owns the space. The
permission is required to include this property.Properties of a button in the spaces toolbar.
object
Sets the background color of the badge. Can be specified as an array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with an HTML color name (red) or a HEX color value (#FF0000 or #F00). Reset when set to null.
[badgeText
]
(string, optional)
Sets the badge text for the button in the spaces toolbar. The badge is displayed on top of the icon. Any number of characters can be set, but only about four can fit in the space. Removed when set to null.
The paths to one or more icons for the button in the spaces toolbar. Reset to the extension icon, when set to null.
Specifies dark and light icons for the button in the spaces toolbar to be used with themes: The light icons will be used on dark backgrounds and vice versa. At least the set for 16px icons should be specified. The set for 32px icons will be used on screens with a very high pixel density, if specified. Reset when set to null.
[title
]
(string, optional)
The title for the button in the spaces toolbar, used in the tooltip of the button and as the displayed name in the overflow menu. Reset to the name of the extension, when set to null.
SpaceTabProperties
Properties for the new tab being opened by clicking on the associated button in the spaces toolbar.
object
[cookieStoreId
]
(string, optional)
The CookieStore id used by the tab. Either a custom id created using the contextualIdentities API, or a built-in one: firefox-default, firefox-container-1, firefox-container-2, firefox-container-3, firefox-container-4, firefox-container-5. Note: The naming pattern was deliberately not changed for Thunderbird, but kept for compatibility reasons. The permission is required to be able to specify this property. Furthermore, the permission should be requested, to enable the contextual identities feature (enabled by default only on Thunderbird Daily).
[linkHandler
]
(string, optional)
Thunderbird is a mail client, not a browser. It is possible to load a web page, but opening follow-up pages through hyperlinks should be handled by the user’s default browser. This property specifies to what extent this behavior should be enforced. The default balanced link handler will open links to the same host directly in Thunderbird, everything else will be opened in the user’s default browser. A relaxed link handler will open all links inside of Thunderbird, a strict link handler will open all links in the user’s default browser, except links to the same page.
Supported values:
strict
balanced
relaxed
[url
]
(string, optional)
The default URL. May point to a WebExtension page or a web page.
External Types
The following types are not defined by this API, but by the underlying Mozilla WebExtension code base. They are included here, because there is no other public documentation available.
IconPath
Either a string to specify a relative path of a single icon to be used for all sizes, or a dictionary object to specify paths for multiple icons in different sizes, so the icon does not have to be scaled for a device with a different pixel density. Each entry is a name-value pair with value being a relative path to an icon file, and name its size. Example:
{
"16": "icon16.png",
"32": "icon32.png"
}
See the MDN documentation about choosing icon sizes for more information on this.
ThemeIcons
Define a set of icons for themes depending on whether Thunderbird detects that the theme uses dark or light text. All provided URLs must be relative to the manifest.json file.
object
dark
(string)
A URL pointing to an icon. This icon displays when a theme using dark text is active (such as the Light theme, and the Default theme if no default_icon
is specified).
light
(string)
A URL pointing to an icon. This icon displays when a theme using light text is active (such as the Dark theme).
size
(integer)
The size of the two icons in pixels, for example 16 or 32.