ui/tray.rs#
Source: lib/ui/tray.rs
tray -- the app's symbol in the notification area and system notifications (plat::tray)
tray_set(icon, tooltip, menu) -> bool show or update the symbol: icon None = the
program's own; menu = Mi rows like a window menu (labels
from the command table, CF_DISABLED / CF_CHECKED /
CF_HIDDEN of cmd_state at this moment: call it again after
a change); false: no notification area here
tray_remove()
notify(title, body, icon) -> id a system notification (0: not shown)
notify_close(id) tray_supported() -> bool
bring_to_front() restore and activate the main window (e.g. on UIC_TRAY)
Headless runs (scripts, --shot) never show anything: plat::tray's dry run prints it.
Events (E_WAKE): a chosen menu row runs App::command(id, 0) like a row of the window's menu;
a click on the symbol App::command(UIC_TRAY, TRAY_ACTIVATE), a double / middle click
UIC_TRAY TRAY_SECONDARY; a clicked notification UIC_NOTE (arg = its id), one that went
away unclicked UIC_NOTE_GONE (arg = its id).
impl Ui
fn tray_set(&mut self, icon: Option<&Surface>, tooltip: &str, menu: &[Mi]) -> boolshow or update the symbol in the notification area -> false: there is none herefn tray_remove(&mut self)take the symbol awayfn notify(&mut self, title: &str, body: &str, icon: Option<&Surface>) -> u32a system notification -> its id (0: not shown); UIC_NOTE / UIC_NOTE_GONE report itfn notify_close(&mut self, id: u32)take a notification awayfn tray_supported(&self) -> boolwhether this system shows the symbol (a notification area; GNOME: only with the AppIndicator extension); notifications work without onefn bring_to_front(&mut self)restore the main window when it is minimised and activate it