terminal-browser README

The project's README from github.com/zenbu-labs/terminal-browser. As one markdown file: README.md.

terminal-browser

A real browser that runs inside your terminal

Installation

curl (macOS & Linux):

curl -fsSL https://terminal-browser.sh/install | bash

Note: Run terminal-browser upgrade to upgrade versions

Homebrew

brew install terminal-browser

Claude code plugin

Install instructions here

Usage

terminal-browser # launches the browser
terminal-browser open <url> # opens the browser at a url
terminal-browser --split right # opens the browser in a split pane to the right
terminal-browser open --ssh <user@host> <url> # performs all network requests through a remote server
terminal-browser ls # lists open browsers
terminal-browser action # an agent-browser compatible cli for interacting with open terminal-browsers
terminal-browser upgrade # upgrade to the latest version

Use cases:

Shortcuts

Action macOS Linux
Quit ctrl+q or ctrl+c ctrl+q
New tab cmd+t ctrl+t
Edit URL cmd+l ctrl+l
Command palette cmd+p ctrl+k or alt+k
Find in page cmd+shift+f ctrl+shift+f
Next / previous match enter / shift+enter enter / shift+enter
Reload cmd+r ctrl+r
Back / forward cmd+[ / cmd+] or ctrl+[ / ctrl+] ctrl+[ / ctrl+]
Zoom in / out / reset your terminal's zoom keybind your terminal's zoom keybind
Devtools cmd+shift+i or f12 ctrl+shift+i or f12
Devtools console cmd+alt+j ctrl+alt+j
Copy / paste / cut cmd+c / cmd+v / cmd+x ctrl+c / ctrl+v / ctrl+x
Record page (start/stop) ctrl+r ctrl+shift+r
Complete recording review ctrl+enter ctrl+enter
Start element selection (send to agent) ctrl+g ctrl+g
Close popup / overlay escape escape

How does it work?

Terminals that support the kitty graphics protocol, including ghostty, kitty, cmux, vscode and many more, allow a program running in a terminal to display pixels in your terminal. We use this capability to display pixels generated by chromium.

We use electrons offscreen rendering API to read pixels generated by chromium directly from the GPU. This allows terminal-browser to render smoothly without dropping any frames.

After the browser engine starts and is displaying pixels in the terminal, it needs to be able to read user input for websites to actually work. terminal-browser listens to mouse clicks, mouse position, and keyboard events from the terminal, and then sends synthetic events to chromium based on that data. For any user input events that are not retrievable from the terminal, we read directly from the operating system using a background swift app to listen for input events (non intrusively). This is what allows terminal-browser to implement smooth scrolling, and listen to trackpad events (websites with infinite canvases work great inside terminal-browser!)

The outer UI of the browser is implemented using a graphics engine built on top of rust. The actual UI is defined inside react with a custom react renderer, which allows us to build the UI for the browser using typescript. The UI of the outer browser and the browser content itself is all drawn to the same shared canvas inside the rust engine, which allows us to layer UI on top of the browser.

The underlying logic described here has been abstracted into a javascript library that you can use to build your own graphical applications in the terminal - https://github.com/zenbu-labs/pixel

SSH

The recommended way to use terminal-browser over ssh is running terminal-browser --ssh <ssh arguments>.

The alternative is running terminal-browser directly on the machine you are shh'd into. This will work, but:

terminal-browser --ssh improves on this by running the website on your local device, and simply proxying all network requests made by the browser via the remote machine over ssh. This means you can load any website running on localhost of the remote machine on your local device.

Embedded mode

terminal-browser supports embedding inside of existing TUIs. See examples/embedded for a reference implementation

Roadmap

Contributing

To get a local development setup of terminal-browser, the recommended way is to ask a coding agent.

Adding enhanced support for a new terminal

terminal-browser's cli includes sub commands that rely on terminal/multiplexer scripting features. To implement support for a terminal/multiplexer not yet supported, reference existing implementations located here https://github.com/zenbu-labs/terminal-browser/tree/main/terminals/src/terminals

Discord

Acknowledgments

terminal-browser (zenbu-labs/terminal-browser)

Searching Database…

这是什么东西?一个在终端里运行的完整网页浏览器。它会在终端窗口里渲染真正的 Chromium 画面,所以你可以在运行 shell 命令的同一个地方直接浏览真实的网站。
它能渲染真实的网站,还是像 Lynx 那样纯文本?是真实的网站,而且是完整的图形显示。它通过 kitty graphics protocol 把 Chromium 实际输出的像素画到终端里,甚至还自带 Chrome DevTools(按 f12 或 cmd+shift+i 打开)。
在任何终端里都能用吗?不行。你的终端必须支持 kitty graphics protocol——ghostty、kitty、cmux、VS Code 等很多终端都支持。
它目前还做不到什么?Chrome 扩展和 design mode 还没上线——这两项都在路线图上,排已经完成的 Linux 支持旁边。
它能在 Windows 上运行吗?按 README 的说法不行:安装方式只针对 macOS 和 Linux,文档和路线图里完全没提 Windows。
在里面能用编程智能体做什么?智能体可以获得完整权限,与任何打开的终端浏览器交互,从而具备真正的网页操作能力。你还可以让它生成一个 HTML 计划页,自动在智能体旁边的分栏中打开;或者按 ctrl+g 选中页面上的某个元素并发送过去。
通过 SSH 使用时它是怎么工作的?推荐使用 'terminal-browser --ssh':网站在你的本地机器上运行,而网络请求通过远程主机代理,这样你就能打开位于远程机器 localhost 上的站点。直接在远程机器上运行也可以,但那样每一帧画面和每一个输入事件都要经过网络传输。
能把它嵌入我自己的 TUI 应用吗?可以。嵌入式模式就是为把浏览器放进现有 TUI 而设计的,仓库在 examples/embedded 下还提供了一个参考实现。
能用它开发自己的图形化终端应用吗?可以。支撑浏览器的那套底层机制——一个 Rust 图形引擎,其界面用 React 加自定义渲染器编写,全部绘制在同一块共享画布上——被抽象成了一个 JavaScript 库,用来构建你自己的图形化终端应用。
Creator
zenbu-labs
Size
2.7 MB
Stars
3.9K
Age
3mo
Commits · 90 Days