carbonyl README

The project's README from github.com/fathyb/carbonyl. As one markdown file: README.md.

   O    O
    \  /
O —— Cr —— O
    /  \
   O    O

Carbonyl

Carbonyl is a Chromium based browser built to run in a terminal. Read the blog post.

It supports pretty much all Web APIs including WebGL, WebGPU, audio and video playback, animations, etc..

It's snappy, starts in less than a second, runs at 60 FPS, and idles at 0% CPU usage. It does not require a window server (i.e. works in a safe-mode console), and even runs through SSH.

Carbonyl originally started as html2svg and is now the runtime behind it.

Usage

Carbonyl on Linux without Docker requires the same dependencies as Chromium.

Docker

$ docker run --rm -ti fathyb/carbonyl https://youtube.com

npm

$ npm install --global carbonyl
$ carbonyl https://github.com

Binaries

Demo

Known issues

Comparisons

Lynx

Lynx is the original terminal web browser, and the oldest one still maintained.

Pros

Cons

Some might sound like pluses, but Browsh and Carbonyl let you disable most of those if you'd like

Browsh

Browsh is the original "normal browser into a terminal" project. It starts Firefox in headless mode and connects to it through an automation protocol.

Pro

Cons

Operating System Support

As far as tested, the operating systems under are supported:

Contributing

Carbonyl is split in two parts: the "core" which is built into a shared library (libcarbonyl), and the "runtime" which dynamically loads the core (carbonyl executable).

The core is written in Rust and takes a few seconds to build from scratch. The runtime is a modified version of the Chromium headless shell and takes more than an hour to build from scratch.

If you're just making changes to the Rust code, build libcarbonyl and replace it in a release version of Carbonyl.

Core

$ cargo build

Runtime

Few notes:

Fetch

Fetch Chromium's code.

$ ./scripts/gclient.sh sync

Apply patches

Any changes made to Chromium will be reverted, make sure to save any changes you made.

$ ./scripts/patches.sh apply

Configure

$ ./scripts/gn.sh args out/Default

Default is the target name, you can use multiple ones and pick any name you'd like, i.e.:

$ ./scripts/gn.sh args out/release
$ ./scripts/gn.sh args out/debug
# or if you'd like to build a multi-platform image
$ ./scripts/gn.sh args out/arm64
$ ./scripts/gn.sh args out/amd64

When prompted, enter the following arguments:

import("//carbonyl/src/browser/args.gn")

# uncomment this to build for arm64
# target_cpu = "arm64"

# comment this to disable ccache
cc_wrapper = "env CCACHE_SLOPPINESS=time_macros ccache"

# comment this for a debug build
is_debug = false
symbol_level = 0
is_official_build = true

Build binaries

$ ./scripts/build.sh Default

This should produce the following outputs:

Build Docker image

# Build arm64 Docker image using binaries from the Default target
$ ./scripts/docker-build.sh Default arm64
# Build amd64 Docker image using binaries from the Default target
$ ./scripts/docker-build.sh Default amd64

Run

$ ./scripts/run.sh Default https://wikipedia.org

carbonyl (fathyb/carbonyl)

Searching Database…

19.5K ·GitHub
这是什么东西?Carbonyl 是一个基于 Chromium 的浏览器,完全在终端里运行,让你不用离开命令行就能浏览现代网页。
它是真正的浏览器,还是更像 Lynx 那种纯文本浏览器?它是真正的 Chromium,不是文本抓取器:它支持几乎所有 Web API,包括 WebGL、WebGPU、音视频播放和动画,直接渲染到终端里。
我需要先安装别的东西吗?只有在不带 Docker 的 Linux 上才需要:这时 Carbonyl 需要和 Chromium 相同的依赖。走 Docker 这条路就可以跳过这些配置。
目前有哪些功能还不行?还不支持全屏模式,也不支持浏览器扩展——扩展已在计划之中(Browsh 目前已经支持)。
它能在哪些系统上运行?Linux(测试过 Debian、Ubuntu 和 Arch)、macOS,以及通过 WSL 运行的 Windows 11。预编译二进制覆盖 amd64 和 arm64 架构的 macOS 和 Linux,而且这个项目实际上只在后两者上做过测试。
它能通过 SSH 在无桌面的服务器上运行吗?可以——这正是它的设计初衷:它完全不需要窗口服务器,能在安全模式的控制台里运行,也能通过 SSH 使用。
它速度快吗?非常快:启动不到一秒,能跑到 60 FPS,空闲时 CPU 占用为 0%。它按终端的分辨率原生渲染,而不是复制窗口画面再缩小,所以非常轻量。
它和 Browsh 有什么不同?Browsh 以无头模式启动 Firefox,并通过自动化协议来驱动它,渲染同样的内容要多耗大约 50 倍的 CPU。Carbonyl 是打过补丁的 Chromium,直接原生渲染;Browsh 更容易更新,而且目前已经支持扩展,Carbonyl 还不行。
它为什么会被做出来——html2svg 是什么?Carbonyl 最初源于 html2svg,一个把网页转换成 SVG 的项目,如今 Carbonyl 就是它背后的运行时。
Which topics is it in?webgpu, chromium, headless, webgl, ssh, app, tui, browser, performance, rust, free, npm
Creator
fathyb
Size
0.3 MB
Stars
19.5K
Age
3y
Commits · 90 Days