System Tray#

class ignis.services.system_tray.SystemTrayService(*args: Any, **kwargs: Any)#

A system tray, where application icons are placed.

Raises:

AnotherSystemTrayRunningError -- If another system tray is already running.

Example usage:

from ignis.services.system_tray import SystemTrayService

system_tray = SystemTrayService.get_default()

system_tray.connect("added", lambda x, item: print(item.title))
added(*args)#
  • Signal

Emitted when a new item is added.

Parameters:

item (SystemTrayItem) -- The instance of the system tray item.

property items: list[SystemTrayItem]#
  • read-only

A list of system tray items.

class ignis.services.system_tray.SystemTrayItem(name: str, object_path: str)#

A system tray item.

removed()#
  • Signal

Emitted when the item is removed.

property id: str#
  • read-only

The ID of the item.

property category: str#
  • read-only

The category of the item.

property title: str#
  • read-only

The title of the item.

property status: str#
  • read-only

The status of the item.

property window_id: int#
  • read-only

The window ID.

property icon: str | gi.repository.GdkPixbuf.Pixbuf | None#
  • read-only

The icon name or a GdkPixbuf.Pixbuf.

property item_is_menu: bool#
  • read-only

Whether the item has a menu.

property menu: DBusMenu | None#
  • read-only

A DBusMenu or None.

Hint

To display the menu, add it to a container, and call the .popup() method on it.

Warning

If you want to add menu to several containers (e.g., make two status bars with a system tray), you must call the copy() method to obtain a copy of the menu. This is necessary because you can't add a single widget to multiple containers.

menu = item.menu.copy()
property tooltip: str#
  • read-only

A tooltip, the text should be displayed when you hover cursor over the icon.

activate(x: int = 0, y: int = 0) None#

Activate the application. Usually this causes an application window to appear.

Parameters:
  • x (int, default: 0) -- x coordinate.

  • y (int, default: 0) -- y coordinate.

Return type:

None

secondary_activate(x: int = 0, y: int = 0) None#

Activate a secondary and less important action compared to activate().

Parameters:
  • x (int, default: 0) -- x coordinate.

  • y (int, default: 0) -- y coordinate.

Return type:

None

context_menu(x: int = 0, y: int = 0) None#

Ask the item to show a context menu.

Parameters:
  • x (int, default: 0) -- x coordinate.

  • y (int, default: 0) -- y coordinate.

Return type:

None

scroll(delta: int = 0, orientation: Literal['horizontal', 'vertical'] = 'horizontal') None#

Ask for a scroll action.

Parameters:
  • delta (int, default: 0) -- The amount of scroll.

  • orientation (Literal['horizontal', 'vertical'], default: 'horizontal') -- The type of the orientation: horizontal or vertical.

Return type:

None