Metadata-Version: 2.4
Name: miragem
Version: 0.12.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: X11 Applications
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: System :: Emulators
License-File: LICENSE
Summary: Ubuntu Touch device emulator for Linux x86_64: UBports PDK images under QEMU/KVM, in a device frame
Keywords: ubuntu-touch,ubports,emulator,qemu,lomiri,clickable
Author: Cyril Jacquet
License-Expression: GPL-3.0-only
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://gitlab.com/miralab/miragem/-/blob/main/CHANGELOG.md
Project-URL: Homepage, https://gitlab.com/miralab/miragem
Project-URL: Issues, https://gitlab.com/miralab/miragem/-/issues
Project-URL: Repository, https://gitlab.com/miralab/miragem

# Miragem

Miragem is an Ubuntu Touch device emulator for Linux x86_64, in the spirit of Android's AVD Manager. It downloads UBports' amd64 PDK images, runs each virtual device under QEMU/KVM, and shows its screen in a device frame that takes clicks, typing and edge swipes. Hardware profiles set the screen size, density and grid unit of real phones and tablets. Docks beside the screen press the hardware buttons, rotate the device, plug in an external monitor, take screenshots, cut the network, open links, post push notifications and feed the device's two cameras a test card, a picture, a video or a camera of the computer. A bridge installed in the guest lists, installs and launches apps, and Clickable projects deploy to a device with one command.

Miragem is experimental. It is tested on the latest stable series, Ubuntu Touch 24.04-2.x. Development started on `ubports/focal` (20.04), so Focal images still run and most features work on them, but they are no longer tested and Focal-only problems are not being fixed. Location, battery, telephony and VM snapshots are not emulated yet, and there is no packaged release: build it from source.

![Miragem running a PinePhone Pro device on Ubuntu Touch 24.04-2.x, with an external Full HD monitor showing the Lomiri desktop and the device controls on the right](docs/img/screenshot_1.png)

## Build from source

A PyPI package installable with `pipx install miragem` is the intended distribution model. It is not available from this repository yet. Use the source build below.

Requirements: Rust from `rust-toolchain.toml`, a running Wayland or X11 desktop, access to `/dev/kvm`, and a Mesa render node. Miragem uses an AMD (`amdgpu`, `radeon`), Intel (`i915`, `xe`) or Nouveau card. With several, it uses the one the firmware started, else the lowest-numbered; Settings ▸ Appearance & Behavior ▸ Graphics appears in that case and overrides the choice, and `MIRAGEM_RENDERNODE` overrides it for one run. The proprietary NVIDIA driver is not one of those cards: Miragem starts on it only when it is the only GPU, and the picture may stay black. The Teksilo UI also needs a working Vulkan or OpenGL driver; on Mesa systems, install `mesa-vulkan-drivers` and `libgl1-mesa-dri` if they are not already provided by your desktop installation.

On Debian/Ubuntu, install the build dependencies and VM tools:

```bash
sudo apt update
sudo apt install build-essential pkg-config \
    libxkbcommon-dev libwayland-dev libxcb1-dev libx11-dev \
    qemu-system-x86 qemu-utils xz-utils curl openssh-client dosfstools mtools \
    ca-certificates xdg-utils
```

The cameras' test card and pictures need nothing more. A camera of the computer and video files go through GStreamer's command-line tools; Settings ▸ Simulation ▸ Camera lists what is missing, with the package for your distribution:

```bash
sudo apt install gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
    gstreamer1.0-pipewire gstreamer1.0-libav
```

`gstreamer1.0-pipewire` reaches laptop cameras that only libcamera drives (most MIPI cameras), and `gstreamer1.0-libav` decodes H.264 and H.265 videos such as a phone records.

Install rustup, the Rust toolchain installer, if `rustup --version` does not already work:

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
```

From the repository root, install the Rust toolchain pinned in `rust-toolchain.toml` (Rust 1.98; rustup's default profile adds `clippy` and `rustfmt`), then build and run:

```bash
rustup toolchain install
cargo build --release -p miragem-app-teksilo
cargo build-guest
export PATH="$PWD/target/release:$PATH"
miragem
```

The compiler and display-library packages follow Skribisto's Linux CI requirements for Teksilo's winit/wgpu stack. `build-essential` also supplies the C compiler that builds Miragem's guest helpers along with the app: the Lomiri input helper and the two that give Qt apps a back and a front camera. They use no headers or development packages, from Qt, GStreamer or anything else. `ca-certificates` supports HTTPS downloads, and `xdg-utils` provides desktop URL opening for the GitLab source link. The enabled Teksilo features do not require GTK or WebKit development packages.

`cargo build-guest` produces the static bridge Miragem installs in every guest; it refuses a dynamically linked one. A source build finds it in `target/x86_64-unknown-linux-gnu/release/`, so rerun `cargo build-guest` after changing `crates/miragem-guest`. To use a bridge from somewhere else, set `MIRAGEM_GUEST_BINARY` to its absolute path; it overrides every other source.

### Build a self-contained binary

Packaged builds, such as the planned PyPI wheel, embed the bridge in the `miragem` executable. Point `MIRAGEM_EMBED_GUEST` at the static bridge while building the app:

```bash
cargo build-guest
MIRAGEM_EMBED_GUEST="$PWD/target/x86_64-unknown-linux-gnu/release/miragem-guest" \
    cargo build --release -p miragem-app-teksilo
```

The build stops if the file is dynamically linked. At first use, `miragem` writes the embedded bridge to `$XDG_CACHE_HOME/miragem/miragem-guest-<version>`, normally under `~/.cache`, and uses it ahead of any build found on disk. Without `MIRAGEM_EMBED_GUEST`, nothing is embedded and Miragem searches as described above.

## Create a VM

1. Open Images and download an amd64 PDK build. `ubports/24.04-2.x`, the latest stable series, is the tested branch.
2. Review or create a hardware profile with the required resolution, DPI, grid unit, RAM and CPU count.
3. Create a device from an image and a profile with **+ New device**. Assign a unique quick name such as `vm1`.
4. Start it. SSH access, display settings and the guest bridge are provisioned automatically.

The image catalogue combines cached remote builds and local downloads. Each VM writes to its own overlay; the downloaded master remains unchanged. Clickable's Docker SDK images are build environments, not bootable disks, and are excluded.

Devices never show Lomiri's edge tutorial ("Swipe from the top edge…"), which would otherwise cover the app you are testing until swiped through. To see the first-use experience, turn on **Settings ▸ Simulation ▸ Lomiri ▸ Show it on devices**: running devices show the steps they have not done yet, as a new phone does, and turning it off hides the tutorial again at once.

## Start again from a clean state

- **A clean device.** **Reset…** in a stopped device's menu, in the Devices list, erases its private disk: the apps installed in it, their data and the device's settings go, and its next start is a new device's first boot, welcome screens included. Its name, quick name, hardware profile, cameras and monitor stay. The device's image must still be downloaded.
- **An app's first launch.** **Clear data** in the Guest dock's **Applications…**, beside each app, stops the app and every other app of its package, then deletes the folders AppArmor gives a confined app for itself: `~/.config/<package>`, `~/.local/share/<package>` and `~/.cache/<package>`. Files it saved elsewhere through a policy group, such as `picture_files`, stay, and so do the package and the permissions it was granted, such as location or the microphone. **Uninstall** removes the package but leaves those folders.

## The workspace

The selected device's screen sits between two docks. On the left, **Devices** lists the virtual devices. On the right, **Controls** stacks the Device (power, hardware keys, gestures), Display (orientation, external monitor) and Guest (bridge, SSH) docks, **Simulate** stacks the simulation tools and the **Camera** dock, and **Files** is its own activity with one dock. A rail on each side switches between them; clicking the selected one hides its side. The buttons at both ends of the status line, and the **View** menu, also show and hide each side, and **View** brings any activity to the front. Drag a dock's divider to resize it, drag a dock's header to another pane, side or rail to move it, and right-click a rail to hide or restore activities. Miragem keeps the arrangement in `layout.toml` in its config directory.

Hardware profiles can be added, duplicated, edited and removed in **Hardware profiles**. A profile a device uses cannot be removed. Edits apply on the next stop/start cycle; active VMs show **Restart required**. Explicit VM RAM and CPU overrides remain in effect.

## Touch and gestures

On a device with a touchscreen, a click or drag with the primary button is a finger, so Lomiri's edge swipes, flicks and long presses work; hovering, the other buttons and the wheel stay a mouse. Two fingers come from the keyboard's modifiers:

- **Ctrl+drag** (**⌘+drag** on macOS) puts a second finger opposite the pointer, mirrored through the centre of the screen. Drag away from the centre to spread the fingers and zoom in, towards it to pinch and zoom out. While the key is held over the screen, outlines show where the fingers will land; they fill in while the fingers touch.
- **Ctrl+Shift+drag** moves both fingers together, as far apart as they landed: a two-finger drag.

The device does not see Ctrl held while the fingers touch. A VM started by Miragem 0.3 or older, or by a QEMU older than 8.1, has no touchscreen: there Ctrl+drag is a plain drag.

## Files

The **Files** activity, on the right-hand rail, lists the selected device's files, starting at `/home/phablet`. A single click selects a row; double-click or Enter opens a folder or file. Drop files onto the list, or use the strip under it, to copy them into the open folder. Opening a file lets the host's usual application edit a copy in `/tmp/miragem`; a save is copied back. Selecting a file prepares its host copy for dragging; wait for the transfer to finish before dragging a large file into another application. Progress and Cancel appear only while a transfer is active. The port that carries the bytes is created when the device starts, so a bridge installed into an already running device picks it up at the next start.

The refresh button beside the breadcrumb reloads the current folder. Host edits keep syncing to their original device while another is selected, and a failed upload is retried while that device's session remains active.

**Settings ▸ Simulation ▸ Files ▸ Root access** is off until turned on. Off, the dock stays inside the device user's home. On, file commands run as root and the dock shows a red **Root access** margin.

Right-click a file and choose **Open with…** to use KDE's or GNOME's native application chooser. Application choices are requested only when you use that action. Files and folders use the host's icon theme; file icons come from its MIME database without downloading guest files. Hover for file size and permissions.

## Simulate device events

The **Simulate** dock, on the right-hand rail, acts on the selected running device:

- **Screenshot** saves the guest screen as a PNG in `~/Pictures/Miragem` (or the data directory's `screenshots` when there is no pictures directory). Its arrow picks the device screen or the plugged-in external monitor (saved as `<device>-monitor-<time>.png`), and the button keeps the last choice.
- **Network** unplugs and replugs the guest's network cable through QEMU, so apps see the device go offline. The guest bridge and the display keep working; SSH, and so Clickable deployment, waits until the cable is back.
- **Open link…** hands a URL to the guest's URL dispatcher, as a tap on a link would: `https:`, `settings:///system/about`, `tel:`, or an app's own scheme.
- **Notification…** posts a push notification to an installed app through the guest's push service, with no push server involved. Only apps that ship a push helper can receive one. Without a custom payload, Miragem sends a card that a pass-through helper shows as is; a custom JSON payload goes to the helper unchanged. If a card does not appear in the app's notification list, Miragem says the helper produced nothing. The preinstalled Calendar and Notes helpers are blocked by AppArmor on Focal images.

Each action reports its result in a snackbar at the bottom of the window. Links and notifications go through the guest bridge.

## On-screen keyboard

Ubuntu Touch's keyboard never appears on a PDK image, so apps never make room for it. **On-screen keyboard** in the Simulate dock, off until turned on, runs the device's real keyboard out of sight: when a text field takes the focus, the app learns that the keyboard is up and how much of the screen it covers, slide included, exactly as on a phone, and Miragem draws a keyboard in that space. Click its keys to type, or keep typing on the computer's keyboard. The space is the real keyboard's; the drawn keys are a stand-in with English letters and a layer of digits and symbols, whatever the field asked for, and they type as hardware keys, without word suggestions.

Portrait only: while the device is sideways the keyboard stays down and apps behave as with a hardware keyboard. The switch is kept in the device and applies again at its next start; it needs the bridge from this version of Miragem. How it works is in [the bridge documentation](docs/bridge.md#on-screen-keyboard).

## Cameras

The **Camera** dock, under Simulate, sets what each of the device's two cameras sees. It is saved with the device, so it can be set while the device is stopped and is there again at the next start:

- **None**: the device has no such camera, as on a phone without one.
- **Camera**: a camera of this computer. It opens only while an app in the device has the camera open, and closes two seconds after the last one lets go, so its light is never on for nothing. **Mirror** flips it left to right.
- **Image**: a still picture, such as a QR code or a barcode to scan. Without one, a test card with the camera's name and a clock, so a frozen picture shows.
- **Video**: a video file, in a loop unless **Loop** is off. **Restart** plays it again from the start.

Under each camera, the dock says what it shows and which apps use it. New devices start with test cards. **Settings ▸ Simulation ▸ Camera** sets the picture size (640 × 480, 1280 × 720 or 1920 × 1080) and frame rate for every device, which host camera to prefer, whether it may stay open while unused, and what new devices start with. An upright device gets the picture turned upright (720 × 1280 for 1280 × 720), as a phone's camera gives it.

The back camera is the one apps open by default. Qt apps see the two as a phone's back and front cameras, so the Camera app's flip button reaches the front one, and so does a QML `Camera` asked to face the front. A camera set to **None** is gone for other apps; Qt apps still list it, as they do on every phone, and get the other camera's picture from it. camera.ubports 4.1.0 to 4.2.0 hang on their splash screen in Miragem; 4.2.1 works, see [troubleshooting](docs/troubleshooting.md#camera). How the frames reach the guest is in [the bridge documentation](docs/bridge.md#cameras).

## Sound

Devices play their sound on this computer: apps, ringtones and notification sounds go to the desktop's PipeWire or PulseAudio, as a stream named after QEMU in the desktop's volume mixer. The device gets a sound card with no microphone, so the computer's microphone is never opened. **Settings ▸ Simulation ▸ Audio** turns it off. The choice applies when a device starts, so a running device keeps the sound it started with. Without PipeWire or PulseAudio, or with a QEMU that lacks the audio module for them, devices start silent.

## External monitor

Ubuntu Touch devices can drive a monitor over USB-C, and so can a running VM: **Plug in monitor** in the Display dock connects the device's monitor to the guest's GPU. Lomiri then shows its desktop on the monitor and turns the device screen into a touchpad. The **Displays** control picks what the workspace shows: the device, the monitor, or both side by side. Click and type on the monitor as on the device screen. **Unplug monitor** brings back the phone layout. Each device has its own monitor, shown in the workspace subtitle; **Change monitor**, beside the plug button, picks another and swaps a plugged-in one. Monitors are edited in **Hardware profiles ▸ External monitor** (name, resolution up to 2560×2048, DPI), which starts with five presets. A VM started by an older Miragem needs a stop and start to gain the port. See [display and orientation](docs/orientation.md#external-monitor) for how it works.

## How a device differs from a phone

A device runs the phone's software: Lomiri, click installation and hooks, and AppArmor, under which each app runs confined by its own profile, in enforce mode. What it runs on differs, and these differences show in apps:

- **amd64, not arm64.** Phones run arm64, some older ones armhf. A compiled app is built for amd64 here, so a bug that depends on the architecture, or a library the package ships for arm64 only, does not show. A package built for arm64 or armhf alone is refused.
- **Qt's Wayland plugin.** The PDK image runs apps with `QT_QPA_PLATFORM=wayland-egl`; phones use `ubuntumirclient`. Behaviour that differs between the two plugins shows on one only: the Camera app's 4.1.0 to 4.2.0 hang here and not on phones (see [troubleshooting](docs/troubleshooting.md#camera)).
- **A device pixel ratio of 1.** Apps get `Screen.devicePixelRatio` 1, where a phone gives its grid unit divided by 8 (3 on a Fairphone 5). Sizes from Lomiri UI Toolkit units (`units.gu`, `units.dp`) follow the profile's grid unit and match the phone's. Sizes in plain pixels, Qt Quick Controls 2 styles that do not use those units, `@2x` images and anything that reads the ratio come out smaller, against the screen, than on the phone.
- **Web content is laid out as on a desktop.** Morph sends a desktop browser's user agent, since the screen reports the physical size of a 100 DPI monitor, and Morph and web apps lay pages out across the screen's full width in pixels: 720 CSS pixels on the Generic x86 profile, against about 400 on a phone. The profile's web scale does not change it. Check a responsive layout on a phone.
- **A mouse pointer on the screen.** Lomiri draws the pointer over the device's screen, where a phone shows none, and **Screenshot** keeps it.
- **A fast processor.** An app starts and runs faster under KVM on a desktop processor than on most phones: judge its speed on a phone.
- **Not emulated:** location, the battery, telephony and SMS, vibration, and every sensor but orientation. The [on-screen keyboard](#on-screen-keyboard) is a stand-in, with English keys and no suggestions, in portrait only.

## Use with Clickable

The current workaround uses Clickable's existing [script command](https://clickable-ut.dev/en/dev/commands.html). Native `clickable miragem` support is a future integration. The current workflow requires no Clickable changes.

Copy the helper into the root of an Ubuntu Touch project:

```bash
mkdir -p scripts
cp /path/to/miragem/integrations/clickable/miragem scripts/miragem
chmod +x scripts/miragem
```

Add these entries to the project's `clickable.yaml`, merging with any existing `scripts` section:

```yaml
scripts:
  miragem: ./scripts/miragem
  miragem-follow: ./scripts/miragem -f
```

Build, review, install and launch:

```bash
clickable script miragem          # Favorite VM, otherwise the first VM
clickable script miragem-follow   # The same, then show the app's output until Ctrl+C
./scripts/miragem vm1             # Explicit quick name
./scripts/miragem vm1 -f          # ... and follow the app's output
./scripts/miragem vm1 --app main  # Select a manifest hook when needed
```

`clickable script` passes no arguments on, so `clickable script miragem vm1` fails: call the helper itself to name a device or add an option, or give each variant its own entry under `scripts`, as `miragem-follow` is.

The helper runs `clickable build --output` in the project root using a fresh temporary directory. A failed build or review stops deployment. Exactly one resulting `.click` package is required. Temporary output is removed when deployment finishes or is cancelled.

With `-f`, once the app runs, the helper shows its output (`console.log`, `qDebug`) from this launch on, until Ctrl+C: what an earlier run printed is left out. `miragem run` takes the same `-f`.

Clickable retains control of the build configuration. Miragem only receives the package. The helper builds for `amd64` by setting `CLICKABLE_ARCH`, whatever architecture Clickable would otherwise take from an attached phone or from `default_arch` in `~/.clickable/config.yaml`; architecture-independent projects still build `all`. A project whose `clickable.yaml` restricts the architecture to another one builds a package Miragem refuses. The package needs a framework installed in the guest. Set `CLICKABLE_BIN` and `MIRAGEM_BIN` to executable paths when using development installations; neither value is a shell command.

### Logs and shell

`miragem logs` prints the apps' output from this boot (`console.log`, `qDebug`); `--app` narrows it to one package and `-f` follows it. `miragem shell` opens a shell on the device, or runs the command after `--`. Both need no setup.

### The alternative: Clickable's own commands over SSH

Clickable can also deploy to a running device by itself, as to a phone over SSH, with no helper and no `scripts` entry. Its device commands (`install`, `launch`, `logs`, `log`, `shell`) reach a phone over SSH and take no key file, so on their own they cannot log into a device. Each device has an SSH name that carries its port, the user `phablet` and Miragem's key: `miragem-` and its quick name. **Settings ▸ Integration ▸ SSH ▸ Add to ~/.ssh/config**, or `miragem ssh-config`, turns the names on, once, by putting one `Include` line at the top of `~/.ssh/config`. Then:

```bash
CLICKABLE_SSH=miragem-vm1 clickable   # build for the device, install and launch
clickable logs --ssh miragem-vm1      # follow the app's output: console.log, qDebug
ssh miragem-vm1                       # a shell on the device
export CLICKABLE_SSH=miragem-vm1      # the same device for every Clickable command
```

Clickable asks the device for its architecture, amd64, and builds for it. Unlike the helper, it neither starts the device nor waits for it: start it in Miragem or with `miragem start vm1` first. Nor does it check, before installing, that the device has the package's framework and has applied its hardware profile's scaling.

Miragem keeps the names in `ssh_config` in its data directory and rewrites it whenever a device is added, removed or renamed. To add the line by hand, put `Include ~/.local/share/miragem/ssh_config` before the first `Host` or `Match` line of `~/.ssh/config`: below one, it applies to that host only. Until the line is there, **SSH access** in the Guest dock warns that the names are not set up and links to their settings page; afterwards it copies `ssh miragem-vm1` rather than the port and key.

## Commands

```bash
miragem run package.click [--vm vm1] [--app hook-name] [-f]
miragem start [vm1]
miragem stop [vm1]
miragem list [--json]
miragem shell [vm1] [-- command]
miragem logs [vm1] [--app id] [-f]
miragem ssh-config [-y]
miragem --version
miragem --help
miragem --start "Display name"  # Legacy interface
```

An explicit quick name takes precedence. Otherwise Miragem selects the favorite, then the first VM in saved order. Unknown names fail. Quick names begin with a lowercase letter and contain lowercase letters, digits or hyphens. Renaming does not change the VM's identity or disk location.

`shell` and `logs` reach a running device directly, with Miragem's key. `ssh-config` shows what it would change in `~/.ssh/config` and asks first; `-y` skips the question, and without a terminal to ask on it stops before changing anything. Terminal commands print only their result; details go to `miragem.log`.

`run` and `start` requests go through one GUI instance per data directory, starting it when none runs; `list` asks it when it runs and reads the registry otherwise. Miragem starts or resumes the selected VM, waits for the bridge, checks compatibility, installs the package and launches its selected hook. With `-f`, `run` then follows the app's output from that launch on, until Ctrl+C. Requests for the same VM run sequentially. With no VMs, the creation dialog stays open until a VM is created or setup is cancelled. Terminal cancellation ends the deployment request and leaves the VM available for inspection.

`stop` shuts the device down as its **Stop** does, through the GUI, and returns once it is off. Without a GUI, it starts one only when a device left running by an earlier one needs stopping; otherwise it says the device is not running.

## Data and scaling

Data lives in `$XDG_DATA_HOME/miragem`, normally `~/.local/share/miragem`. Set an absolute `MIRAGEM_DATA_DIR` to use an isolated inventory. The registry migrates older VMs without changing UUIDs, disk paths or list order. It assigns `vm1`, `vm2`, and subsequent quick names, with no initial favorite. The window's size and placement are kept there too, in `window_state.toml`; the interface choices and the dock layout are in the config directory, normally `~/.config/miragem`.

Each hardware profile has its own grid unit: the real device's for the presets, 18 for a new profile. The profile's web scale, which the device gets as DeviceInfo's `WebkitDpr` and the session's `QTWEBKIT_DPR`, follows DPI, 2.0 at 320 DPI, unless the profile overrides it. Morph and web apps read neither, so it does not change how pages are drawn: see [how a device differs from a phone](#how-a-device-differs-from-a-phone). A screen whose long side exceeds 2048 pixels boots scaled down to fit, and both scales shrink with it. See [display and orientation](docs/orientation.md) for details.

## Logs

Miragem logs to `<data>/miragem.log` as well as to stderr, so a GUI opened from a launcher still leaves a record. Every failure shown in a panel is logged with its full cause; the panels keep only their latest message. The file is appended to; once it passes 10 MiB, the next start moves it to `miragem.log.1` and begins a new one. `RUST_LOG` sets the level, `miragem=info,warn` by default:

```bash
RUST_LOG=miragem=debug miragem
```

Other logs:

- `<data>/manager.log`: the output of a GUI started by a CLI request.
- `<data>/vms/<id-prefix>/qemu.log`: QEMU's output for each VM.
- `journalctl --user -u miragem-guest`, inside the guest: the guest bridge. See [troubleshooting](docs/troubleshooting.md#bridge-or-provisioning-failure).

## Development and validation

```bash
cargo test --workspace
cargo test -p miragem-app-teksilo --features mocks --target-dir target/mocks
cargo build -p miragem-app-teksilo --features mocks --target-dir target/mocks
python3 scripts/probe_miragem.py
python3 scripts/probe_orientations.py
python3 scripts/probe_docks.py
python3 scripts/probe_dock_help.py
python3 scripts/probe_monitor.py
python3 -m unittest discover -s integrations/clickable -p 'test_*.py'
```

The test of the guest's camera plugin loads it into this computer's GStreamer, and passes silently without checking anything unless `gstreamer1.0-plugins-good` and `gstreamer1.0-plugins-bad` are installed.

Tests cover the registry, migration, selection, UI controls, protocol, provisioning and helper failure handling. Socket tests require local Unix sockets. Image tests require `xz`, `qemu-img`, `mkfs.vfat` and `mtools`. Real guest acceptance additionally requires KVM, graphics access and a compatible PDK disk.

The Teksilo 0.26.0 frontend lives in `miragem-app-teksilo`; its executable remains `miragem`. Persistent MVVM handles bind to the UI-independent `miragem-backend` command/snapshot API. The GUI installs Teksilo's Tokio adapter and injects its handle into backend services; terminal-only requests use their own runtime. No Qleany layer is required.

The `mocks` feature swaps in an isolated in-memory client with simulated operations and a synthetic framebuffer. It opens no production socket, runs no host tools, writes no log file and does not use the network or saved registry. `MIRAGEM_MOCK_SCENARIO=empty` starts with an empty inventory; `quit` opens the shutdown choices. The probe requires the mock binary and writes dark/light screenshots and results to `/tmp/miragem-probe`. Rebuild without `--features mocks` to use real VMs again.

Device management is available from each inventory item’s context menu. Portrait/landscape changes show a waiting spinner until the guest repaints; see [orientation testing](docs/orientation.md#waiting-for-a-mode-change) for real-VM probes and timing details.

Backend tasks are drained before releasing the GUI runtime. Framebuffers use `LiveImageDiffWriter`; typed state events carry revisions, and guest operations are scoped to VM/session generations. The registry and the control socket's messages kept their formats through the port to Teksilo.

The other workspace crates, and the rules the code follows, are described in [the architecture notes](docs/architecture.md).

- [Architecture](docs/architecture.md)
- [Guest bridge and provisioning](docs/bridge.md)
- [Display and orientation](docs/orientation.md)
- [Troubleshooting](docs/troubleshooting.md)

