1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-26 23:04:49 +03:00
A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
Go to file
2019-02-22 15:21:07 -08:00
.cargo Now with something approximating windows support 2018-07-20 20:39:16 -07:00
ci skip building harfbuz on macos 2019-02-19 08:59:39 -08:00
screenshots add screenshot 2018-02-19 22:10:59 -08:00
src add default metrics accessor to FontConfiguration struct 2019-02-22 15:21:07 -08:00
term more fun with keyboard input with glutin/winit 2019-02-20 20:30:19 -08:00
termwiz update termwiz to 2018 edition 2019-02-18 23:26:41 -08:00
.gitignore start building out the terminal model 2018-07-12 07:26:37 -07:00
.gitmodules unbundle the generated harfbuzz rust bindings 2018-02-22 21:10:50 -08:00
.rustfmt.toml update rustfmt for 1.28 2018-08-03 22:34:27 -07:00
.travis.yml remove coverage bits from travis build 2019-02-19 23:59:02 -08:00
Cargo.toml implement coretext font rendering 2019-02-22 15:21:04 -08:00
CONTRIBUTING.md Add get-deps script for installing dependencies 2018-02-25 09:24:56 -08:00
get-deps use the open crate for url clicking 2019-02-18 22:57:40 -08:00
ISSUE_TEMPLATE.md Create ISSUE_TEMPLATE.md 2018-02-25 08:22:55 -08:00
LICENSE.md restructure termwiz tree prior to merging into wezterm repo 2018-08-05 07:55:30 -07:00
README.md revise config example in the readme 2019-02-20 09:06:26 -08:00
wt-record Add some helper scripts for diagnostic purposes 2018-02-25 08:01:32 -08:00
wt-replay Add some helper scripts for diagnostic purposes 2018-02-25 08:01:32 -08:00

Wez's Terminal

A terminal emulator implemented in Rust, using OpenGL ES 2 for rendering.

Build Status

Screenshot

Screenshot of wezterm on X11, running vim

Quickstart

  • Install rustup to get the rust compiler installed on your system. https://www.rust-lang.org/en-US/install.html
  • Build in release mode: cargo build --release
  • Run it via either cargo run --release or target/release/wezterm

You will need a collection of support libraries; the get-deps script will attempt to install them for you. If it doesn't know about your system, please contribute instructions!

$ curl https://sh.rustup.rs -sSf | sh -s
$ git clone --depth=1 --branch=master https://github.com/wez/wezterm.git
$ cd wezterm
$ sudo ./get-deps
$ cargo build --release
$ cargo run --release

What?

Here's what I'm shooting for:

  • A terminal escape sequence parser
  • A model of a terminal screen + scrollback that is OS independent
  • Textual and GUI rendering of the model
  • A differential protocol for the model

This would manifest as a common core that could run as both a textual terminal multiplexer and a gui terminal emulator, where the GUI part could automatically provide a native UI around the remotely multiplexed terminal session.

Status / Features - Alpha Quality

There may be bugs that cause the terminal to panic. I'd recommend using tmux or screen to keep your session alive if you are working on something important!

Despite the warning above, I've been using wezterm as my daily driver since the middle of Feb 2018. The following features are done:

  • Runs on Linux under X (requires OpenGL ES 2)
  • Scrollback (use mouse wheel and Shift Page{Up|Down})
  • True Color support
  • Ligatures, Color Emoji and font fallback
  • xterm style selection of text with mouse; paste selection via Shift-Insert (bracketed paste is supported!)
  • SGR style mouse reporting (works in vim and tmux)
  • Render underline, double-underline, italic, bold, strikethrough
  • Configuration file to specify fonts and colors
  • Hyperlinks per: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
  • Multiple Windows (Hotkey: Super-N)
  • Tabs (Hotkey: Super-T, next/prev: Super-[ and Super-], go-to: Super-[0-9])
  • Run on macOS (in progress)
  • Run on Windows (in progress)

There's a good number of terminal escape sequences that are not yet implemented and that will get fleshed out as the applications I use uncover them, or as folks report them here and raise the priority. Similarly for key mappings. Please don't be shy about contributing support for missing things!

Things that I'd like to see happen and that have no immediate priority; contributions to get closer to these are welcomed!

Configuration

wezterm will look for a TOML configuration file in $HOME/.config/wezterm/wezterm.toml, and then in $HOME/.wezterm.toml.

Configuration is currently very simple and the format is considered unstable and subject to change. The code for configuration can be found in src/config.rs.

I use the following in my ~/.wezterm.toml:

font_size = 10
font = { font = [{family = "Operator Mono SSm Lig Medium"}] }
# How many lines of scrollback to retain
scrollback_lines = 3500

[[font_rules]]
italic = true
font = { font = [{family = "Operator Mono SSm Lig Medium", italic=true}]}

[[font_rules]]
italic = true
intensity = "Bold"
font = { font = [{family = "Operator Mono SSm Lig", italic=true, bold=true}]}

[[font_rules]]
intensity = "Bold"
  [font_rules.font]
  font = [{family = "Operator Mono SSm", bold=true}]
  # if you liked xterm's `boldColor` setting, this is how you do it in wezterm,
  # but you can apply it to any set of matching attributes!
  foreground = "tomato"

[[font_rules]]
intensity = "Half"
font = { font=[{family = "Operator Mono SSm Lig Light" }]}

The default configuration will attempt to use whichever font is returned from fontconfig when monospace is requested.

Colors

You can configure colors with a section like this. In addition to specifying SVG/CSS3 color names, you can use #RRGGBB to specify a color code using the usual hex notation; eg: #000000 is equivalent to black:

[colors]
foreground = "silver"
background = "black"
cursor_bg = "springgreen"
ansi = ["black", "maroon", "green", "olive", "navy", "purple", "teal", "silver"]
brights = ["grey", "red", "lime", "yellow", "blue", "fuchsia", "aqua", "white"]

Performance

While ultimate speed is not the main goal, performance is important! Using the GPU to render the terminal contents helps keep CPU usage down and the output feeling snappy.

Here's a very basic benchmark:

$ find /usr > /tmp/usr-files.txt
$ wc -l /tmp/usr-files.txt
364885 /tmp/usr-files.txt
$ time cat /tmp/usr-files.txt

And a comparison between some terminal emulators on my system; they were each set to 80x24 with 3500 lines of scrollback. alacritty has no scrollback.

Terminal Time (seconds)
xterm 9.863
Gnome Terminal 2.391
Terminator 1.91 2.319
wezterm 0.940
kitty 0.899
urxvt 0.615
alacritty 0.421

Getting help

This is a spare time project, so please bear with me. There are two channels for support:

The gitter room is probably better suited to questions than it is to bug reports, but don't be afraid to use whichever you are most comfortable using and we'll work it out.