Application Launchers

Source: apps/launchers/README.md

The apps.launchers package starts, stops, and monitors external applications used by higher-level UIs.

Responsibilities

Launchers may:

  • start an owned subprocess;
  • set the X11 display environment;
  • wait for an external service to become ready;
  • open a browser kiosk;
  • stop owned subprocesses;
  • perform display-scoped fallback cleanup.

Launchers must not contain panel or Tk widget logic.

Managed application actions and owned browser/process lifecycle now emit runtime.* structured events. Failures retain exception types and numeric process context without command lines, URLs, native output, or paths. See the runtime logging guide for events, live viewing, and lifecycle semantics.

Interface

Every launcher implements:

launch(remote_display, set_status=None)
stop(remote_display, set_status=None)
toggle(remote_display, set_status=None) -> bool
is_running() -> bool

toggle() returns True when the application is running after the operation and False when it has been stopped.

Implementations

  • BrowserKioskLauncher: Chromium or Chrome kiosk window.
  • StreamlitLauncher: Streamlit server plus kiosk browser.
  • WeatherDashLauncher: configured Streamlit launcher for apps/weatherDash/main.py.
  • SdrForgeServiceLauncher: shared RF service readiness without subprocess ownership.
  • ADSBLauncher: readsb service plus tar1090 kiosk browser.
  • AppLauncherStub: deterministic test implementation.

Process ownership

A launcher first terminates the exact subprocess it created. A display-scoped pattern search is used only as fallback cleanup for processes that survived a previous application run.

Avoid global pkill -f cleanup because it can terminate unrelated user processes.

ADS-B and Weather belong to the same exclusive auxiliary-dashboard browser group. Launching either dashboard closes the other browser window on that X display, while leaving independently managed backend services available.

Map renderer

MapRendererLauncher selects the native map renderer launcher for the current runtime environment:

  • Termux uses development/termux/start_map_renderer.sh.
  • Native Linux uses scripts/runtime/start_map_renderer.sh.
  • OPENROADCODE_MAP_RENDERER_COMMAND overrides automatic launcher selection.

The native Linux launcher uses these defaults:

  • navigation installation: /opt/openroadcode/navigation;
  • runtime configuration: /etc/openroadcode/navigation.toml;
  • map data: /srv/openroadcode;
  • runtime cache: ~/.cache/openroadcode.

These locations can be overridden with the corresponding OPENROADCODE_* environment variables.

Runtime dependencies

Browser kiosk support requires one of:

chromium-browser
chromium
google-chrome

Streamlit launchers require the Python package:

python3 -m pip install streamlit

StreamlitLauncher.prepare() starts the server and waits for HTTP readiness without opening a browser, allowing frontends to warm dashboards in a daemon worker after their primary startup path completes. close_browser() hides the dashboard without discarding that warmed server; stop() releases both.

ADS-B launch requires a systemd-managed readsb service and a reachable tar1090 installation. ORC never opens an interactive privilege prompt: the unit must be controllable by the running user through systemd policy. A missing unit or unavailable non-interactive authorization fails immediately and is reported in the ORC status surface.

On hardware-free development hosts, ADS-B may still open a reachable tar1090 dashboard without live receiver data. Reopening a dashboard tile raises its existing browser window instead of interpreting the action as a request to stop a hidden kiosk; the Return overlay owns dashboard shutdown.

Testing

Use AppLauncherStub when launcher behavior itself is irrelevant to a consumer test.

Process launchers should be tested with mocked subprocess, shutil.which, and socket calls rather than starting real desktop applications in unit tests.