exlab_wizard.tray.window_launcher#

Spawn / focus the on-demand window subprocess. Backend Spec §4.3.2.

The tray clicks Open -> WindowLauncher either:

  • spawns a fresh exlab-wizard-window subprocess via subprocess.Popen() when no window is currently alive, or

  • focuses the existing window (best-effort) when one is already up.

The tray process never blocks on the window subprocess; it polls Popen.poll() to detect window-exit and treats a stale child as “no window present” on the next Open click.

This module is deliberately small: pywebview-driven focus is OS-specific and best-effort. On Linux without a working xdotool the launcher falls back to spawning a second window, which pywebview tolerates on some desktop environments and not others – this is acceptable per §4.3.2’s “best-effort” note.

Classes

WindowLauncher(*[, window_executable])

Spawn exlab-wizard-window as a subprocess, track its PID.

class exlab_wizard.tray.window_launcher.WindowLauncher(*, window_executable=None, state_dir)[source]#

Bases: object

Spawn exlab-wizard-window as a subprocess, track its PID.

On a re-open request with an existing live child, focuses the existing window (best-effort) rather than spawning a duplicate (Backend §4.1: “single-instance window”).

Parameters:
close()[source]#

Terminate the live window subprocess, if any. Idempotent.

Return type:

None

property is_alive: bool#

Return True while the window subprocess is running.

open()[source]#

Spawn a window subprocess, or focus the existing one.

Return type:

None

property pid: int | None#

Return the live window’s PID, or None if no window is up.