WIT package, MoonBit components, Node host and tests (WIP)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e5548fc067
commit
e0bde1d150
125 files changed
+8681
No files matched your search
@@ -0,0 +1,42 @@
|
||||
///| 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)
|
||||
}
|
||||
Reference in new issue
Block a user