What it does
desktop_widgets
Reusable widget builders for desktop-style Lua UIs, built on zui.
Pure builders — every function returns a widget tree and owns no
state. Used by desktop_screens to assemble shortcuts, taskbar
buttons, and window chrome.
Exports
M.shortcutTile(shortcut: Shortcut, selected: boolean, opts: ShortcutTileOpts?) -> any— icon + label tile, optionally rendered in the selected state.M.taskbarButton(label: string, callbackId: string, isActive: boolean, palette: ButtonPalette?, opts: TaskbarButtonOpts?) -> any— bottom-taskbar button with active/inactive palette swap.M.windowTitlebar(title: string, opts: TitlebarOpts?) -> any— title label + minimize/maximize/close buttons in a row.
Types:
Shortcut = { id, label, icon_src? }ShortcutTileOpts = { callback_id?, image_id?, panel_id? }ButtonPalette = { activeBg?, inactiveBg?, borderColor?, borderWidth?, color? }TaskbarButtonOpts = { width? }TitlebarOpts = { minimize_icon?, maximize_icon?, close_icon?, title_id?, title_style?, spacer_width?, minimize_id?, minimize_style?, maximize_id?, maximize_style?, close_id?, close_style?, row_id?, row_style? }
Usage
local DesktopWidgets = require("@builtin::modules.desktop_widgets")
local tile = DesktopWidgets.shortcutTile(shortcut, isSelected)
local btn = DesktopWidgets.taskbarButton("Start", "desktop:start:toggle", false)
local bar = DesktopWidgets.windowTitlebar("My Computer", {
close_id = "desktop:my_computer:close",
minimize_id = "desktop:my_computer:minimize",
maximize_id = "desktop:my_computer:maximize",
})
Notes
- All builders are pure — no
_Gmutation, no engine calls. Safe to call from any frame. - Default callback ids (
desktop:shortcut:click:<id>,window:minimize,window:maximize,window:close) are placeholders; window consumers always override them with screen-specific ids. - Builders return opaque widget trees; downstream code feeds them into
Z.vbox/Z.panel/Z.areainstead of inspecting the structure.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.