Shellby Shellbydocs
指南Guides ← 返回首页← Home

多会话 · 分屏Sessions & Split View

把桌面级的多终端能力带到每一端。

会话标签

  • 每个连接是一个标签。点标签栏 + 在当前窗口新建会话。
  • 拖拽标签可重排顺序。
  • ⌘W 关闭当前会话(Mac / iPad 硬件键盘)。

分屏

  • Mac / iPad 点「分屏」即可并排显示所有会话,排布支持 自动 / 左右 / 上下 / 网格。
  • iPhone 仅在 横屏 下分屏(竖屏并排太窄不可读)。

断线重连

会话假死 / 断线会被自动探测并重连;也可右键标签强制「重新连接」。

Mosh 兼容连接

主机可以选用 Mosh 兼容传输:它走 UDP,切换 Wi-Fi / 蜂窝网络、设备休眠唤醒之后会话都不会断,弱网下打字也不会卡顿堆积。

但它不保留滚动历史。这是协议本身的取舍,不是缺陷:该协议同步的是「当前这一屏应该长什么样」,而不是完整的输出字节流——滚出屏幕的内容在服务端就被丢弃了,从来没有经网络传过来。所以在 Mosh 兼容会话里往上翻是空的,跑 tail -f、seq 1 1000 这类持续输出时尤其明显。mosh 官方客户端同样如此。

  • 需要回头翻阅输出 → 用 SSH 连接,滚动历史完整保留(回滚行数可在「设置 ▸ 终端」调整)。
  • 既要漫游又要历史 → 在远端跑 tmux 或 screen,由它接管历史,用 Ctrl-b [ 进入复制模式翻页。

常见问题

在 tmux 里滑动滚不动?

tmux 接管了整个屏幕,默认不把滚动交给终端——手指滑动到它那里只是一串按键。三种办法:

  • 让 tmux 接管滚动:在服务器的 ~/.tmux.conf 加一行 set -g mouse on,执行 tmux source-file ~/.tmux.conf 或重开会话。之后滑动会进入 tmux 的复制模式翻历史,按 q 退出。需要 Apple 端 2.0.0、Android / 鸿蒙 1.1.8 及以上——更早的版本发出的滚轮编码 tmux 不认。
  • 不改配置:按 Ctrl-b [ 进入复制模式,再滑动或用快捷键条的方向键翻页,q 退出。
  • 在 tmux 里跑 pi 这类命令行 agent:优先用程序自己的全屏模式,例如 pi --tui-mode fullscreen(或在 /settings 里把 TUI mode 改成 fullscreen)。全屏模式下程序自己订阅鼠标、自己滚动,tmux 会原样透传,不需要改任何 tmux 配置。pi 的默认模式画在主屏、依赖终端自身的回滚,而 tmux 里那份历史是它一帧帧叠上去的画面,翻起来会重叠,这是 pi 侧的已知问题。

vim、less、man 不在此列:它们没订阅鼠标时,滑动会自动转成方向键,本来就能滚。

Desktop-class multi-terminal on every device.

Session tabs

  • Each connection is a tab. Tap + in the tab bar to open a new session in the current window.
  • Drag tabs to reorder.
  • ⌘W closes the current session (Mac / iPad hardware keyboard).

Split View

  • On Mac / iPad, tap “Split” to show all sessions side by side — arrange auto / columns / rows / grid.
  • On iPhone, split is available in landscape only (portrait is too narrow to read).

Auto-reconnect

Stalled / dropped sessions are detected and reconnected automatically; you can also force “Reconnect” from a tab’s context menu.

Mosh-compatible connections

A host can use the Mosh-compatible transport. It runs over UDP, so sessions survive Wi-Fi ↔ cellular switches and device sleep, and typing stays responsive on lossy links.

It keeps no scrollback. That is inherent to the protocol, not a defect: it synchronises what the screen should look like right now rather than the full stream of output — lines that scroll off are discarded on the server and never travel over the network. Scrolling up in a Mosh-compatible session therefore shows nothing, which is most obvious with continuous output such as tail -f or seq 1 1000. The official mosh client behaves the same way.

  • Need to read back through output → use SSH, where scrollback is kept in full (buffer size is configurable under Settings ▸ Terminal).
  • Want both roaming and history → run tmux or screen on the server and page through its copy mode with Ctrl-b [.

FAQ

Swiping does nothing inside tmux?

tmux owns the whole screen and, by default, does not hand scrolling to the terminal — a swipe reaches it as nothing more than keystrokes. Three ways out:

  • Let tmux take over scrolling: add set -g mouse on to ~/.tmux.conf on the server, then run tmux source-file ~/.tmux.conf or start a new session. Swiping now enters tmux copy mode and pages through its history; press q to leave. Requires Apple 2.0.0 or Android / HarmonyOS 1.1.8 and later — older builds sent a wheel code tmux does not recognise.
  • Without changing config: press Ctrl-b [ to enter copy mode, then swipe or use the arrow keys on the shortcut bar; q exits.
  • Running a CLI agent such as pi inside tmux: prefer the program's own full-screen mode, e.g. pi --tui-mode fullscreen (or set TUI mode to fullscreen under /settings). In full-screen mode the program requests the mouse and scrolls itself; tmux passes the events straight through and no tmux configuration is needed. pi's default mode draws on the main screen and relies on the terminal's own scrollback — inside tmux that history is a stack of its redrawn frames, so paging through it looks garbled; that is a known limitation on pi's side.

vim, less and man are not affected: when they have not requested the mouse, swipes are turned into arrow keys and scroll as expected.