spacesToolbar API

The spacesToolbar API allows to manage built-in and custom spaces, and to add buttons for custom spaces to Thunderbird’s spaces toolbar.

Functions

addButton(id, properties)

– [Added in TB 100]

Adds a new button to the spaces toolbar. Throws an exception, if the used id is not unique within the extension.

Parameters

id

id

(string)

The unique id to assign to this button. May only contain alphanumeric characters and underscores.

properties

properties

Properties of the new button. The url is mandatory.

Return type (Promise)

_returns

integer

– [Added in TB 115]

The id of the space belonging to the newly created button, as used by the tabs API.

clickButton(id, [windowId])

– [Added in TB 114]

Trigger a click on the specified spaces toolbar button. Throws an exception if the requested spaces toolbar button does not exist or was not created by this extension.

Parameters

id

id

(string)

The id of the spaces toolbar button. May only contain alphanumeric characters and underscores.

windowId

[windowId]

(integer, optional)

The id of the normal window, where the spaces toolbar button should be clicked. Defaults to the most recent normal window.

Return type (Promise)

_returns

Details about the opened or activated tab.

removeButton(id)

– [Added in TB 100]

Removes the specified button from the spaces toolbar. Throws an exception if the requested spaces toolbar button does not exist or was not created by this extension. If the tab of this button is currently open, it will be closed.

Parameters

id

id

(string)

The id of the spaces toolbar button, which is to be removed. May only contain alphanumeric characters and underscores.

updateButton(id, properties)

– [Added in TB 100]

Updates properties of the specified spaces toolbar button. Throws an exception if the requested spaces toolbar button does not exist or was not created by this extension.

Parameters

id

id

(string)

The id of the spaces toolbar button, which is to be updated. May only contain alphanumeric characters and underscores.

properties

properties

Only specified properties will be updated.

Types

ButtonProperties

– [Added in TB 100]

object

badgeBackgroundColor

[badgeBackgroundColor]

(string or ColorArray, optional)

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 an empty string.

badgeText

[badgeText]

(string, optional)

Sets the badge text for the spaces toolbar button. 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 an empty string.

defaultIcons

[defaultIcons]

(string or IconPath, optional)

The paths to one or more icons for the button in the spaces toolbar. Defaults to the extension icon, if set to an empty string.

themeIcons

[themeIcons]

(array of ThemeIcons, optional)

Specifies dark and light icons for the spaces toolbar button 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.

title

[title]

(string, optional)

The title for the spaces toolbar button, used in the tooltip of the button and as the displayed name in the overflow menu. Defaults to the name of the extension, if set to an empty string.

url

[url]

(string, optional)

The page url, loaded into a tab when the button is clicked. Supported are https:// and http:// links, as well as links to WebExtension pages.

ColorArray

– [Added in TB 100]

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

ExtensionFileUrl

string

ExtensionURL

A path relative to the root of the extension.

string

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 topic.

object

or

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

dark

The dark icon to use for light themes

light

light

A light icon to use for dark themes

size

size

(integer)

The size of the icons