Skip to content

System Tray

class SystemTrayItemPixmap (width: int | None = None, height: int | None = None, data: bytearray | None = None)

Bases: NamedTuple

A class for storing image data associated with a tray item

Create new instance of SystemTrayItemPixmap(width, height, data)

attribute width int | None

icon width size in pixels

attribute height int | None

icon height size in pixels

attribute data bytearray | None

the actual data representing this icon

def as_pixbuf (size: int | None = None, resize_method: Literal['hyper', 'bilinear', 'nearest', 'tiles'] = 'nearest') Pixbuf | None

Load a Pixbuf variant of this pixmap

  • Returns: the newly created pixbuf in which it has the contents of this pixmap
  • Return type: GdkPixbuf.Pixbuf | None

class SystemTrayItemToolTip (icon_name: str | None = None, icon_pixmap: SystemTrayItemPixmap | None = None, title: str | None = None, description: str | None = None)

Bases: NamedTuple

A class for storing tooltip data associated with a tray item

Create new instance of SystemTrayItemToolTip(icon_name, icon_pixmap, title, description)

attribute icon_name str | None

free-desktop compliant name for an icon

attribute icon_pixmap SystemTrayItemPixmap | None

icon data as a pixmap

attribute title str | None

title for this tooltip

attribute description str | None

descriptive text for this tooltip. It can contain also a subset of the HTML markup language

class SystemTrayItem (proxy: DBusProxy, **kwargs)

Bases: Service

A system tray item that implements the FDO’s StatusNotifierItem interface (see https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem)

Default service constructor (base constructor)

  • Parameters: **kwargs

    mapped to signal connections (e.g. on_clicked=lambda *_: … connects the given function to the signal “clicked”, notify_my_property=my_func connects the given function to the signal “notify::my-property”)

signal changed (self) NoneType

signal removed (self) NoneType

def get_preferred_icon_pixbuf (size: int | None = None, resize_method: Literal['hyper', 'bilinear', 'nearest', 'tiles'] | InterpType = GdkPixbuf.InterpType.BILINEAR) Pixbuf | None

Query a Pixbuf of this item’s icon based on a preferred size

  • Parameters:
    • size (int | None , optional) — the preferred size to look up using in the list of given icons (by the application), defaults to None
    • resize_method (Literal [ “hyper” , “bilinear” , “nearest” , “tiles” ] | GdkPixbuf.InterpType , optional) — the way we should resize this Pixbuf, defaults to GdkPixbuf.InterpType.BILINEAR
  • Returns: the newly loaded Pixbuf object (resized to the given size)
  • Return type: GdkPixbuf.Pixbuf | None

property id int

An identifier integer given by the application

  • Returns: the id integer
  • Return type: int

property identifier str

The local identifer of this tray item, based on the dbus of the owner application

  • Returns: the local identifer
  • Return type: str

property title str

The title of the application that owns this tray item

  • Returns: the application’s title
  • Return type: str

property status Literal['passive', 'active', 'unknown']

A string representing this item’s application status

  • Returns: this item’s application status, “passive” means it can be considered “idle” and holding no important message, “active” means it is important that this item should get displayed to the user (e.g. time sensitive status), and finally “unknown”, which infers the inability to get the status (e.g. not provided at all)
  • Return type: str

property category Literal['application-status', 'communications', 'system-services', 'hardware', 'unknown']

This item’s category

  • Returns: description
  • Return type: str

property window_id int

property icon_theme_path str

property icon_theme IconTheme

property icon_name str

property icon_pixmap SystemTrayItemPixmap

property overlay_icon_name str

property overlay_icon_pixmap SystemTrayItemPixmap

property attention_icon_name str

property attention_icon_pixmap SystemTrayItemPixmap

property tooltip SystemTrayItemToolTip

property is_menu bool

property menu_object_path str

property menu Menu

def context_menu (x: int, y: int) None

to open a server-side context menu

def activate (x: int, y: int) None

def secondary_activate (x: int, y: int) None

def invoke_menu_for_event (event: Event) None

def scroll (delta: int, orientation: Literal['vertical', 'horizontal']) None

def context_menu_for_event (event: EventAny) None

def activate_for_event (event: EventAny) None

def secondary_activate_for_event (event: EventAny) None

def scroll_for_event (event: EventScroll) None

class SystemTray (**kwargs)

Bases: Service

Default service constructor (base constructor)

  • Parameters: **kwargs

    mapped to signal connections (e.g. on_clicked=lambda *_: … connects the given function to the signal “clicked”, notify_my_property=my_func connects the given function to the signal “notify::my-property”)

signal changed (self) NoneType

signal item_added (self, item_identifier: str) NoneType

signal item_removed (self, item_identifier: str) NoneType

property items dict[str, SystemTrayItem]

Tray items held by this server

  • Returns: a dict that maps local identifers to tray item objects
  • Return type: dict[str, SystemTrayItem]

def add_item (item: SystemTrayItem) None

def remove_item (item: SystemTrayItem) None