Tray Module — Polybar User Manual 3.7.2 documentation

# Tray Module

type = internal/tray

Added in version 3.7.0.

The tray module displays system tray application icons on the bar.

This module is a bit different from the other modules. The tray icons (also called clients) are individual windows managed by their respective application (e.g. the Dropbox tray icon is created and managed by the Dropbox application). Polybar is only responsible for embedding the windows in the bar and positioning them correctly.

Attention

Only a single instance of this module can be active at the same time (across all polybar instances in the same graphical session).

The way the system tray protocol works, at most one tray can exist at any time. Polybar will produce a warning if additional tray instances are created. This also applies when another tray application (e.g. `stalonetray`) is active.

For transparent background colors, the tray will use pseudo-transparency, true transparency is not possible for the tray icons.

## Formats

The module only has a single format:

format
  Type:

    |type-format|

  Available Tags:

    `<tray>`: Shows tray icons

  Default Value:

    `<tray>`

## Settings

tray-spacing

  Space added between tray icons

  Type:

    |type-extent|, non-negative

  Default Value:

    `0px`

tray-padding

  Space added before and after each tray icon

  Type:

    |type-extent|, non-negative

  Default Value:

    `0px`

tray-size

  Size of individual tray icons

  Type:

    |type-pwo|, relative to bar height, non-negative

  Default Value:

    66%

tray-background

  Background color of tray icons

  Note

  This only affects the color of the individual icons and not the space in between, changing this setting to anything else than the bar background will likely not look good unless the background color is also changed for the rest of the tray module (e.g. with `format-background`).

  Type:

    color

  Default Value:

    `${root.background}`

tray-foreground

  Tray icon color

  This serves as a hint to the tray icon application for which color to use for the icon.

  This is not guaranteed to have any effect (likely only in GTK3) because it targets a non-standard part of the system tray protocol by setting the `_NET_SYSTEM_TRAY_COLORS` atom on the tray window.

  Type:

    color

  Default Value:

    `${tray-foreground}`

## Example

    [module/tray]
    type = internal/tray

    format-margin = 8px
    tray-spacing = 8px

## Migrating From Legacy Tray Implementation

Polybar version 3.7 introduced the new tray module and deprecated the legacy tray implementation which uses `tray-position` to position the tray. You should switch over to the tray module as soon as possible.

The legacy tray was configured in the bar section, the setting for the module live in that module's section of the config file. The settings in the bar section don't always directly correspond to an equivalent setting in the module section for the new tray module.

The following lists how each old setting in the bar section should be migrated:

`tray-position`

  The tray is now positioned as a module and so its positioning is done by placing it where you want it to appear in one of the three module lists `modules-left`, `modules-center`, `modules-right`.

`tray-detached`

  This setting does not have an equivalent, detaching the tray is no longer possible.

`tray-maxsize`

  The `tray-size` setting now determines the size of tray icons.

`tray-transparent`

  Was already deprecated and does not exist in the tray module. Transparency is enabled automatically if a transparent background is used.

`tray-background`

  Also exists in the module section (see `tray-background`). Now, the setting only applies to the icons themselves and no longer to the space around them.

`tray-foreground`

  Also exists in the module section with the same functionality (see `tray-foreground`).

`tray-offset-x`, `tray-offset-y`

  Has no direct equivalent in the module settings. Horizontally, the tray can be moved in the same way other module content can be moved; by reordering the modules or using things like `format-offset`, `format-margin`, or `format-padding`. The tray can't be moved vertically.

  In any case, the tray can no longer be moved outside of the bar window.

`tray-padding`

  Spacing between tray icons works a bit different now and needs to be completely reconfigured (see `tray-padding` and `tray-spacing`).

`tray-scale`

  No longer exist. The size of the icons is solely determined by `tray-size`.

## References

- System Tray Protocol Specification

- XEmbed Protocol Specification