///| Implementation of `moonplasma:desktop/plasmoid` for the launcher. /// The state machine lives in lib/launcher; this adapts host capabilities. ///| let state : @logic.State = @logic.State::new() ///| pub fn info() -> PlasmoidInfo { { id: "org.moonplasma.launcher", name: "Application Launcher", preferred: { w: 150, h: 34 }, min_width: 60, stretch: false, } } ///| pub fn render(size : @types.Size) -> Array[@types.DrawOp] { @logic.render_button(size, @theme.get_tokens(), state) } ///| pub fn popup() -> PopupSurface? { if !state.open { return None } let apps = @app_catalog.list_apps() Some({ size: @logic.popup_size(apps, state), ops: @logic.render_popup(apps, @theme.get_tokens(), state), }) } ///| pub fn on_event(target : Surface, event : @types.InputEvent) -> Bool { let t : @logic.Target = match target { WIDGET => Widget POPUP => Popup } @logic.handle_event(@app_catalog.list_apps(), state, t, event, @app_launch.launch) }