# v0.7.0

URL: https://tuios.dev/releases/v0-7-0

> Video playback in a pane, the kitty keyboard protocol, a rebuilt copy mode with a real scrollbar, a command palette, and the hundred fixes it took to make graphics passthrough honest.

157 commits between v0.6.0 and v0.7.0: 34 features and over a hundred fixes.
The terminal inside tuios now speaks the protocols real programs use:

- Video plays in a pane.
- fish 4.x's kitty keyboard handshake works.
- Copy mode has a scrollbar you can grab.
- A command palette lists every action.

Most of the fixes are the cost of passing another terminal's protocol through a
multiplexer: clipping, positioning, flicker, and the gap between what a spec
says and what mpv sends.

## Changed behaviour

- The mouse wheel now enters copy mode. The separate scrollback mode, which
  could scroll but not select, is gone.
- The dock's clock, CPU and RAM meters are off by default, and are only polled
  when shown.
- A new `--confirm-quit` flag and `confirm_quit` option always ask before
  quitting.

## Video playback

`mpv --vo=kitty` plays video in a tuios pane, and so does
[youterm](https://github.com/Gaurav-Gosain/youterm). Shared memory and base64
modes both work. Use `--vo-kitty-use-shm=yes`: it sends a file reference per
frame instead of streaming megabytes of pixels through the terminal.

Video is the hardest case for graphics passthrough, and most of the fixes were
here:

- mpv marks every frame "more data coming" and never sends the final-chunk
  marker the protocol says to wait for, so passthrough that worked for static
  images waited forever.
- Each frame used to get a new image ID, forcing a delete and replace with a
  visible flash. Frames now reuse the host's image ID, so the terminal swaps
  the data in place.
- File-based frames are forwarded as a path instead of being read, base64
  encoded and chunked, which saves about 4MB of allocation per frame at 30fps.
- All graphics output is wrapped in synchronized updates and flushed with the
  render cycle. Text and graphics arriving as two unsynchronized streams caused
  the tearing.

Static images got the same care: icat and yazi previews clip at the viewport,
hide when their window leaves the screen, and follow the window during a drag.

## The keyboard protocol shells expect

The VT emulator implements the kitty keyboard protocol: the full push, pop and
query stack, with keys sent in CSI u encoding when a program has the protocol
on. fish 4.x turns it on at startup, and before this release capital letters
arrived as escape sequences fish ignored. As the spec says, shifted printable
keys now send their text, and CSI u is kept for real modifier combinations.

The same work added:

- OSC 4 palette queries and OSC 52 clipboard.
- Modes 2026 (synchronized output) and 2027 (unicode core).
- Sixel in the DA1 reply.
- OSC 66 text sizing, as an experimental passthrough (see
  [Known limitations](https://tuios.dev/releases/v0-7-0#known-limitations)).

## Copy mode

- The mouse wheel drops you into copy mode, so scrolling up and selecting are
  one gesture. It has full vim navigation, visual and visual-line selection,
  search and yank.
- The border is a scrollbar, drawn in the theme's border colours and sized to
  the content. Click it to jump and drag it to scroll.
- Dragging a selection past the edge of the pane keeps scrolling on a timer,
  so the selection keeps growing while the mouse is still.

A new scrollback browser splits your history into command blocks using OSC 133
markers, with a regex fallback for shells that do not emit them. Each block is
a command and its output, navigable with vim keys, and you can yank JSON
fragments and file paths out of the output. fish and a configured starship both
emit OSC 133.

*[An interactive figure goes here. Open the page to use it.](https://tuios.dev/releases/v0-7-0)*

## Command palette, sessions and layouts

- **Command palette** on `Ctrl+P`: every tuios action, fuzzy-searched, with its
  key shown beside it. A match on the name ranks above a match on the
  category. It floats at the top of the screen and works in both modes.
- **Session switcher** on `prefix+S` lists daemon sessions the same way.
- **Layout templates** save the BSP tree, each window's working directory (read
  from `/proc`), startup commands, and the tiling scheme. Positions scale when
  you load a template on a different screen size. Loading moves existing
  windows into place instead of killing them, and minimizes extras. The CLI is
  `tuios layout list`, `delete`, `dir` and `export`, and `export` turns a
  template into a tape script. The layout submenu is on `Ctrl+B L`.
- **Zoom** on `z` fills the screen with the focused pane. Press it again to
  restore. The dock shows a Z while zoomed.
- **Shared borders.** With `--shared-borders`, tiled windows are drawn without
  borders and a single line with proper junctions separates them, which saves
  two columns and two rows per split. It is opt-in because it took several
  attempts: the feature was reverted and reimplemented three times before the
  separator overlay stuck.
- **Smart split** picks the split direction from the focused pane's shape. It
  is opt-in because as a default it made narrow slices, so spiral stays the
  default.

*[An interactive figure goes here. Open the page to use it.](https://tuios.dev/releases/v0-7-0)*

## Faster underneath

- Rendering is driven by PTY output instead of a tick. The tick remains only
  for animations and tape playback, and slows to an idle rate when nothing
  moves. With the dock meters off by default, idle CPU is near zero.
- Unfocused windows without a selection take a fast path that skips per-cell
  styling. Windows on other workspaces skip render work, and tuios-web and SSH
  clients do not even receive their output until you switch to them.
- Base64 image data passes through without a decode and re-encode, which saves
  about 8MB of memory traffic per 4MB image. `/dev/tty` is opened once instead
  of per frame, and only placements that moved are placed again.
- tuios moved to the stable Charm v2 releases: bubbletea, lipgloss, wish and
  log.

## Fixed

Most graphics fixes are described above. The rest, grouped:

**Daemon mode**

- The daemon's emulator dropped kitty graphics capability queries, so icat and
  chafa fell back to blocks. The daemon now answers them.
- PTY sizes sync on reattach instead of keeping the previous client's size.
- The client sends its pixel size and graphics capabilities to the daemon at
  hello.
- The subscriber buffer is 16 times larger, so video frames survive the socket
  from daemon to client.

**Input and mouse**

- Mouse motion is only sent to programs that asked for it. kakoune got
  hundreds of unrequested motion events a second
  ([#78](https://github.com/Gaurav-Gosain/tuios/issues/78)).
- Phantom keypresses from split mouse sequences are suppressed.
- Visual line mode highlights at once instead of on the next cursor move.

**Colours and light themes**

- Unstyled cells use the terminal's real default foreground instead of white,
  and SGR 39 and 49 reset to transparent instead of a fixed default. This fixes
  light themes ([#41](https://github.com/Gaurav-Gosain/tuios/issues/41),
  [#72](https://github.com/Gaurav-Gosain/tuios/issues/72),
  [#74](https://github.com/Gaurav-Gosain/tuios/issues/74)).

**Responsiveness**

- Closing a window with `exit` or `ctrl+d` no longer waits out a 500ms timeout
  (now 10ms), and a race that lost the close notification about half the time
  is gone.
- Background windows no longer show stale content until you touch them.

**Other**

- Tape scripts send CRLF on Windows, contributed by @dodorz.
- Many smaller fixes to scrollback, tiling toggles and overlay positioning are
  listed in the
  [full changelog](https://github.com/Gaurav-Gosain/tuios/compare/v0.6.0...v0.7.0).

## Known limitations

- OSC 66 text sizing breaks with scrollback and when a window moves.
- Sixel passthrough exists but is disabled until pixel-level clipping is
  implemented, so sixel images cannot be cropped to a window. Use kitty
  graphics.
- The kitty animation protocol (`a=f`, `a=a`, `a=c`) was tried and dropped. It
  needs image IDs to match between guest and host, and tuios remaps them. Run
  programs that use it outside tuios for now.
- Video without shared memory can flicker, depending on frame rate.
