Files
chandra/components/launcher/gen/interface/chandra/desktop/plasmoid/stub.mbt
T
nandi 905dab8725
CI / test (push) Failing after 52s
Add a built-in on-screen keyboard for handset sessions
- Opens for text-input-v3 fields, terminals, launcher search, Network password, emoji picker and the password dialog; a KB pill summons it manually.
- Enabled on CHASSIS=handset; CHANDRA_OSK=1|0 overrides, and it stays off under CHANDRA_TEST_CONFIG.
- Work area and panel popups shrink above the keyboard so focused content stays visible.
- Keys send evdev codes with Shift, Ctrl and Alt modifiers.
- chandra-ctl: `screenshot [PATH]` saves a PNG without opening the editor.
- Key names cover the full punctuation set and shifted symbols.
- Launcher plasmoid min width drops from 60 to 36.
2026-11-28 00:18:32 -08:00

61 lines
1.7 KiB
MoonBit

///| Implementation of `chandra:desktop/plasmoid` for the launcher.
/// The state machine lives in lib/launcher; this adapts host capabilities: the app catalog and
/// launch, each app's .desktop icon (`icons`, published by the shell for the rows shown), and for
/// the session row `session` (reload, log out) and `power` (suspend, restart,
/// power off, the same calls as the Settings Power tab).
///|
let state : @logic.State = @logic.State::new()
///|
pub fn info() -> PlasmoidInfo {
{
id: "org.chandra.launcher",
name: "Application Launcher",
preferred: { w: 150, h: 34 },
min_width: 36,
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, icon=id => @icons.app_icon(id)),
})
}
///|
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, session=run_action)
}
///| Carry out a (confirmed) session-row action.
fn run_action(a : Int) -> Unit {
if a == @logic.action_reload {
@session.reload()
} else if a == @logic.action_logout {
@session.logout()
} else if a == @logic.action_suspend {
@power.suspend()
} else if a == @logic.action_restart {
@power.reboot()
} else if a == @logic.action_power_off {
@power.power_off()
}
}