Skip to content

System Tray

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

Section titled “ SystemTrayItemPixmap ”

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

Section titled “ width ”

icon width size in pixels

attribute height int | None

Section titled “ height ”

icon height size in pixels

attribute data bytearray | None

Section titled “ data ”

the actual data representing this icon

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

Section titled “ as_pixbuf ”

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)

Section titled “ SystemTrayItemToolTip ”

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

Section titled “ icon_name ”

free-desktop compliant name for an icon

attribute icon_pixmap SystemTrayItemPixmap | None

Section titled “ icon_pixmap ”

icon data as a pixmap

attribute title str | None

Section titled “ title ”

title for this tooltip

attribute description str | None

Section titled “ description ”

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

class SystemTrayItem (proxy: DBusProxy, **kwargs)

Section titled “ SystemTrayItem ”

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

Section titled “ changed ”

signal removed (self)NoneType

Section titled “ removed ”

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

Section titled “ get_preferred_icon_pixbuf ”

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

An identifier integer given by the application

  • Returns: the id integer
  • Return type: int

property identifier str

Section titled “ identifier ”

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

  • Returns: the local identifer
  • Return type: 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']

Section titled “ status ”

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']

Section titled “ category ”

This item’s category

  • Returns: description
  • Return type: str

property window_id int

Section titled “ window_id ”

property icon_theme_path str

Section titled “ icon_theme_path ”

property icon_theme IconTheme

Section titled “ icon_theme ”

property icon_name str

Section titled “ icon_name ”

property icon_pixmap SystemTrayItemPixmap

Section titled “ icon_pixmap ”

property overlay_icon_name str

Section titled “ overlay_icon_name ”

property overlay_icon_pixmap SystemTrayItemPixmap

Section titled “ overlay_icon_pixmap ”

property attention_icon_name str

Section titled “ attention_icon_name ”

property attention_icon_pixmap SystemTrayItemPixmap

Section titled “ attention_icon_pixmap ”

property tooltip SystemTrayItemToolTip

Section titled “ tooltip ”

property is_menu bool

Section titled “ is_menu ”

property menu_object_path str

Section titled “ menu_object_path ”

property menu Menu

Section titled “ menu ”

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

Section titled “ context_menu ”

to open a server-side context menu

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

Section titled “ activate ”

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

Section titled “ secondary_activate ”

def invoke_menu_for_event (event: Event)None

Section titled “ invoke_menu_for_event ”

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

Section titled “ scroll ”

def context_menu_for_event (event: EventAny)None

Section titled “ context_menu_for_event ”

def activate_for_event (event: EventAny)None

Section titled “ activate_for_event ”

def secondary_activate_for_event (event: EventAny)None

Section titled “ secondary_activate_for_event ”

def scroll_for_event (event: EventScroll)None

Section titled “ scroll_for_event ”

class SystemTray (**kwargs)

Section titled “ SystemTray ”

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

Section titled “ changed ”

signal item_added (self, item_identifier: str)NoneType

Section titled “ item_added ”

signal item_removed (self, item_identifier: str)NoneType

Section titled “ item_removed ”

property items dict[str, SystemTrayItem]

Section titled “ items ”

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

Section titled “ add_item ”

def remove_item (item: SystemTrayItem)None

Section titled “ remove_item ”