# Launcher
`deft/stdext/launcher` is the built-in app launcher: a grid of app icons
that scans the configured package roots for packages tagged `"app"` and
launches the selected one into the calling panel. The TUI host opens it
when a workspace has no explicit content, resolved through the prelude
`:launcher` mount.
import "deft/stdext/launcher"
The module declares `implements Deftlet` and is driven by the host
through the deftlet contract, so user code normally never
imports it. The discovery and launch functions are documented because
custom launchers reuse them.
## API
| Def | Signature | Description |
|---|---|---|
| `load-apps` | `{||}` | Scan every `:pkgs` root plus the stdext tree; sorted, deduped app list |
| `filter-apps` | `{| all-apps query |}` | Case-insensitive substring filter; empty query shows all |
| `set-query` | `{| state query |}` | Replace the query, recompute the list, reset selection/scroll |
| `find-existing-instance` | `{| name |}` | Panel id of a visible running instance, or 0 |
| `launch-selected` | `{| state |}` | Launch/focus the selection (reuse visible, adopt docked, else `tui/launch`) |
| `scan-root` | `{| root |}` | Scan one package root |
| `find-entry` | `{| pkg-dir name |}` | Resolve an app's entry `.dft` |
| `app-manifest?` | `{| manifest |}` | True when the manifest's tags include `"app"` |
| `stdext-dir` | `{||}` | The stdext `src/` tree (bundled apps) |
Each discovered entry is `%{ name path icon-path }`. Installed copies
shadow bundled ones because dedup is by name, first occurrence wins.
## Behaviour
- Layout — icon grid (`TILE_W 8`, `TILE_H 3`) or a compact list when
the panel is too small. `can-svg` capabilities choose hi-res SVG icons
via `draw/image`; otherwise an initial-letter tile is drawn (ANSI-safe).
- Keys — typing filters, backspace edits, escape clears, `f` forces a
new instance, enter launches; arrows / PageUp / PageDown / Home / End
and the mouse wheel navigate.
- Reuse — a visible instance is focused (closing the launcher), a
docked one is adopted with `tui/adopt`, otherwise `tui/launch` spawns
a fresh panel.
## See Also
- App Platform — workspaces, launcher patterns, `tui/launch`
- Deftlet — the panel-app contract the launcher implements
- Graphics — `draw/image` and the SVG/ANSI fallback