LavaUI docs GitHub

class StatusNotifierTray

Swift

final class StatusNotifierTray

System tray host: owns org.kde.StatusNotifierWatcher and surfaces items for a panel strip.

Pair of PanelMenu for global menus. The heavy lifting is in canvas (StatusNotifierHost); this is the Swift view-model — poll, rebuild a list of TrayItems with uploaded textures, and forward clicks.

Sources/LavaUI/StatusNotifier.swift:11

Constructors

init(editor: Editor)

Starts the tray through editor: owns the watcher name if it is free, follows the existing one otherwise.

Sources/LavaUI/StatusNotifier.swift:47

Properties

var isServing: Bool { get set }

Whether the tray is live: owning org.kde.StatusNotifierWatcher, or following the one another desktop owns.

Sources/LavaUI/StatusNotifier.swift:41

var items: [TrayItem] { get set }

The tray items, in the order the host lists them.

Sources/LavaUI/StatusNotifier.swift:43

var openMenuKey: String? { get set }

The item whose menu is open, and its contents.

One at a time: a tray menu is a popup, and the pointer that opens a second one closed the first.

Sources/LavaUI/StatusNotifier.swift:125

Methods

func aboutToShow(_ id: MenuID)

"This submenu is about to open" — applets are allowed to fill one only when asked.

Sources/LavaUI/StatusNotifier.swift:160

@discardableResult func activate(_ item: TrayItem) -> Bool

A left click.

Activate when the item implements it, and its menu when it does not — which is not a fallback but the normal case: everything built on libappindicator (nm-applet, most GTK applets) implements no methods at all and publishes a Menu object instead. Calling Activate on one of those is a message to nobody, which is exactly what clicking the icon used to do.

Returns true when a menu was opened, so the caller can show it.

Sources/LavaUI/StatusNotifier.swift:106

func activateMenuItem(_ id: MenuID)

Runs an item in the applet that owns it.

Sources/LavaUI/StatusNotifier.swift:153

func closeMenu()

Closes the open tray menu. The applet is not told.

Sources/LavaUI/StatusNotifier.swift:145

@discardableResult func contextMenu(_ item: TrayItem) -> Bool

A right click: the menu if there is one, ContextMenu otherwise — some applets implement the call and export nothing to render.

Sources/LavaUI/StatusNotifier.swift:115

@discardableResult func openMenu(_ item: TrayItem) -> Bool

Opens item's menu. Returns false if it exports none — activate it instead.

Sources/LavaUI/StatusNotifier.swift:132

@discardableResult func poll() -> Bool

Pump D-Bus and rebuild items when something changed.

Sources/LavaUI/StatusNotifier.swift:64

func scroll(_ item: TrayItem, delta: Int32)

Sends the item delta vertical scroll steps.

Sources/LavaUI/StatusNotifier.swift:173

Types