1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-29 00:21:57 +03:00
A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
Go to file
2019-06-09 11:14:43 -07:00
.cargo Now with something approximating windows support 2018-07-20 20:39:16 -07:00
assets Embed icon into windows executable and titlebar 2019-03-24 19:08:07 -07:00
base91 dyn everywhere 2019-06-08 21:28:11 -07:00
ci Ask travis to build and publish a .deb to a github release 2019-03-24 17:49:28 -07:00
deps probably fixup build for windows 2019-05-29 12:42:20 -07:00
promise dyn everywhere 2019-06-08 21:28:11 -07:00
pty add spawn rpc 2019-06-09 08:15:37 -07:00
screenshots add screenshot 2018-02-19 22:10:59 -08:00
src make mux traits Downcast-able 2019-06-09 11:14:43 -07:00
term remove defunkt write_all function 2019-06-09 07:36:30 -07:00
termwiz clippy 2019-06-09 07:33:00 -07:00
.gitignore Revert "add snapcraft build config" 2019-05-04 08:25:30 -07:00
.gitmodules remove esctest 2019-03-23 14:30:54 -07:00
.rustfmt.toml update rustfmt for 1.28 2018-08-03 22:34:27 -07:00
.travis.yml travis: install fakeroot for deb packaging 2019-03-24 18:23:04 -07:00
appveyor.yml appveyor: revise deploy filter 2019-03-24 16:03:48 -07:00
build.rs Embed icon into windows executable and titlebar 2019-03-24 19:08:07 -07:00
Cargo.toml add Downcast trait to FrontEnd 2019-06-09 11:13:05 -07:00
CONTRIBUTING.md Add get-deps script for installing dependencies 2018-02-25 09:24:56 -08:00
get-deps adjust get-deps for recent deps changes 2019-03-23 15:30:18 -07:00
install.sh refine deploy scripts/config 2019-03-24 00:26:53 -07: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 couple of readme fixes 2019-06-08 16:26:34 -07:00
wt-record update record/play scripts for macos 2019-03-22 20:41:50 -07:00
wt-replay update record/play scripts for macos 2019-03-22 20:41:50 -07:00

Wez's Terminal

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

Build Status Build status

Screenshot

Screenshot of wezterm on X11, running vim

Installing a package

  • Linux, macOS and Windows packages are available from the Releases page
  • Bleeding edge Windows package available from Appveyor

Installing from source

  • 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 --recursive https://github.com/wez/wezterm.git
$ cd wezterm
$ git submodule update --init
$ sudo ./get-deps
$ cargo build --release
$ cargo run --release -- start

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 - Beta 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 3)
  • macOS
  • Windows 10 with ConPty
  • True Color support
  • Ligatures, Color Emoji and font fallback
  • Hyperlinks per: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
  • Scrollback (use mouse wheel and Shift Page{Up|Down})
  • 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
  • Multiple Windows (Hotkey: Super-N)
  • Tabs (Hotkey: Super-T, next/prev: Super-[ and Super-], go-to: Super-[1-9])

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.

Shortcut / Key Binding Assignments

The default key bindings are:

Modifiers Key Action
SUPER v Paste
SHIFT Insert Paste
SUPER m Hide
SUPER n SpawnWindow
ALT Enter ToggleFullScreen
SUPER - DecreaseFontSize
CTRL - DecreaseFontSize
SUPER = IncreaseFontSize
CTRL = IncreaseFontSize
SUPER 0 ResetFontSize
CTRL 0 ResetFontSize
SUPER t SpawnTab
SUPER w CloseCurrentTab
SUPER 1 ActivateTab(0)
SUPER 2 ActivateTab(1)
SUPER 3 ActivateTab(2)
SUPER 4 ActivateTab(3)
SUPER 5 ActivateTab(4)
SUPER 6 ActivateTab(5)
SUPER 7 ActivateTab(6)
SUPER 8 ActivateTab(7)
SUPER 9 ActivateTab(8)
SUPER|SHIFT [ ActivateTabRelative(-1)
SUPER|SHIFT ] ActivateTabRelative(1)

These can be overridden using the keys section in your ~/.wezterm.toml config file. For example, you can disable a default assignment like this:

# Turn off the default CMD-m Hide action
[[keys]]
key = "m"
mods = "CMD"
action = "Nop"

The key value can be one of the following keycode identifiers. Note that not all of these are meaningful on all platforms:

Hyper, Super, Meta, Cancel, Backspace, Tab, Clear, Enter, Shift, Escape, LeftShift, RightShift, Control, LeftControl, RightControl, Alt, LeftAlt, RightAlt, Menu, LeftMenu, RightMenu, Pause, CapsLock, PageUp, PageDown, End, Home, LeftArrow, RightArrow, UpArrow, DownArrow, Select, Print, Execute, PrintScreen, Insert, Delete, Help, LeftWindows, RightWindows, Applications, Sleep, Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9, Multiply, Add, Separator, Subtract, Decimal, Divide, NumLock, ScrollLock, BrowserBack, BrowserForward, BrowserRefresh, BrowserStop, BrowserSearch, BrowserFavorites, BrowserHome, VolumeMute, VolumeDown, VolumeUp, MediaNextTrack, MediaPrevTrack, MediaStop, MediaPlayPause, ApplicationLeftArrow, ApplicationRightArrow, ApplicationUpArrow, ApplicationDownArrow.

Alternatively, a single unicode character can be specified to indicate pressing the corresponding key.

Possible Modifier labels are:

  • SUPER, CMD, WIN - these are all equivalent: on macOS the Command key, on Windows the Windows key, on Linux this can also be the Super or Hyper key. Left and right are equivalent.
  • SHIFT - The shift key. Left and right are equivalent.
  • ALT, OPT, META - these are all equivalent: on macOS the Option key, on other systems the Alt or Meta key. Left and right are equivalent.

You can combine modifiers using the | symbol (eg: "CMD|CTRL").

Possible actions are listed below. Some actions require a parameter that is specified via the arg key; see examples below.

Name Effect
SpawnTab Create a new tab in the current window
SpawnWindow Create a new window
ToggleFullScreen Toggles full screen mode for current window
Paste Paste the clipboard to the current tab
ActivateTabRelative Activate a tab relative to the current tab. The arg value specifies an offset. eg: -1 activates the tab to the left of the current tab, while 1 activates the tab to the right.
ActivateTab Activate the tab specified by the arg value. eg: 0 activates the leftmost tab, while 1 activates the second tab from the left, and so on.
IncreaseFontSize Increases the font size of the current window by 10%
DecreaseFontSize Decreases the font size of the current window by 10%
ResetFontSize Reset the font size for the current window to the value in your configuration
SendString Sends the string specified by the arg value to the terminal in the current tab, as though that text were literally typed into the terminal.
Nop Does nothing. This is useful to disable a default key assignment.
Hide Hides the current window
Show Shows the current window
CloseCurrentTab Equivalent to clicking the x on the window title bar to close it: Closes the current tab. If that was the last tab, closes that window. If that was the last window, wezterm terminates.

Example:

# Turn off the default CMD-m Hide action
[[keys]]
key = "m"
mods = "CMD"
action = "Nop"

# Macro for sending in some boiler plate.  This types `wtf!?` each
# time CMD+SHIFT+W is pressed
[[keys]]
key = "W"
mods = "CMD|SHIFT"
action = "SendString"
arg = "wtf!?"

# CTRL+ALT+0 activates the leftmost tab
[[keys]]
key = "0"
mods = "CTRL|ALT"
action = "ActivateTab"
# the tab number
arg = "0"

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"]

You can find a variety of color schemes here. There are two ways to use them with wezterm:

  • The wezterm directory contains configuration snippets that you can copy and paste into your wezterm.toml file to set the default configuration.
  • The dynamic-colors directory contains shell scripts that can change the color scheme immediately on the fly. This is super convenient for trying out color schemes, and can be used in your own scripts to alter the terminal appearance programmatically.

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.

If you want the absolute fastest terminal emulator, alacritty is currently king of the crop.

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.