tray
Canonical Import
fennel
(local tray (require :tray))Source Files
src/lua_tray.cppsrc/lua_runtime.cpp
What It Provides
tray creates and drives a platform tray icon with menu items, callbacks, update, loop, and support information.
API Summary
supportedis a table withsupported,backend, andreason.support()returns support info.create(spec)returns a tray handle.spec.iconis a string andspec.menuis an array of menu item tables.- Menu entries include
text, optionaldisabled,checked,checkable,cb, and nestedsubmenu. - Handle methods:
start(),update([spec]),loop(blocking?),exit(),last-error(), andbackend().
Examples
fennel
(local tray (require :tray))
(when tray.supported.supported
(local t (tray.create {:icon "icon.png"
:menu [{:text "Quit" :cb (fn [_] (print "quit"))}]}))
(t:start)
(t:loop false))Errors and Platform Notes
Invalid specs raise errors. start returns false and stores last-error when the backend is unavailable or missing runtime tray dependencies. Tray behavior depends on OS desktop environment support.
Related Modules
Aliases and Search Terms
Search terms: system tray, status icon, tray menu, menu callbacks.
