# Spike 3: the second window `spike-windows` opens a main window and, on Ctrl+O (or the Open Studio button), a Studio-like window with `cx.open_window` (`gpui_kit::open_window`, which wraps the view in gpui-component's `Root`). Both windows render one root entity, `Shared`: a counter both change (Ctrl+K or +1 in either), the push-to-talk state, which window is active, and the studio's preview. - **Preview.** GPUI cannot read a window's pixels (no `take_snapshot`), so the studio's preview comes from where the client gets it today: the engine's compositor (`voelin_media::studio::Studio` with one scene of the test pattern, 1920x1080 at 30 fps) and its preview tap at the studio's default 960x540, 15 fps (RGBA). A thread converts each preview frame to one BGRA `RenderImage`; the shared entity holds it and both windows show the same `Arc` (`img()`), the replaced one leaves every window's atlas (`cx.drop_image(old, None)`). - **Global push-to-talk.** `voelin_platform::hotkey::HotkeyManager::x11` on the display (XInput2 raw events on the root window: whichever window has focus, nothing grabbed), F8 by default (`--hotkey`). Its events (a tokio `UnboundedReceiver`) are read by a GPUI foreground task, which needs no tokio reactor, and set the shared model. - **Close and fullscreen.** Closing the studio window (`on_window_should_close`) docks the studio back into the main window and the app goes on; closing the main window quits. F11 toggles fullscreen in either window; Ctrl+Tab activates the other window (`Window::activate_window`). Every change is a JSON line on stdout (`{"event": …}`); with `--seconds` the meter adds its once-a-second CPU and memory lines. ## Reproducing ```sh spikes/gpui/shell.sh sh -c 'cd spikes/gpui && cargo build --locked --release' # the scenario and its eleven checks (PASS/FAIL), screenshots in $OUT: spikes/gpui/shell.sh spikes/gpui/headless.sh -- spikes/gpui/windows/drive.sh # the cost of the shared preview: CPU and memory with the main window # alone, with both windows showing it, and without the compositor (45 s # each, 10 s of warm-up; .jsonl and .load in $OUT): spikes/gpui/shell.sh spikes/gpui/headless.sh -- spikes/gpui/windows/measure.sh ``` `drive.sh` (xdotool on the headless display, keys through XTEST so the hotkey's raw events see them): Ctrl+O in the main window; Ctrl+K twice in the studio window; F8 held while the studio window has focus; F11 twice; Ctrl+Tab; Ctrl+K in the main window; Alt+F4 on the studio window (openbox asks it to close); F8 with the main window active; Alt+F4 on the main window. Results: [docs/design/gpui-spikes.md](../../../docs/design/gpui-spikes.md#spike-3-the-second-window).