Wezterm

February 19, 2024   

TL;DR:

Wezterm is a nice GPU accelerated cross platform terminal.

What is Wezterm ?

Quoting its website:

WezTerm is a powerful cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust

Why ?

During my daily work, my terminal emulator requirements are as follows:

Must to have

  • Being able to split both vertically and horizontally with a configurable 3-key keyboard shortcut (CTRL+SHIFT+E/O)
  • Automatic maximization during startup
  • Copy & Paste via CTRL+SHIFT+C/V
  • Scrollbar
  • Infinite Scrollback
  • Font display resizing via mouse wheel
  • Font & Theme configuration

Nice to have

  • Cross platform ( Linux & Windows )
  • GPU Accelerated rendering

I am using Gnome-terminator for +10 years. It fulfills all my “must to have” requirements, but it is not GPU accelerated and AFAIK not cross platform. However, I love its easyness and feels-at-home :)

My Terminator Config

stulluk ~ $  cat .config/terminator/config 
[global_config]
  window_state = maximise
[keybindings]
[profiles]
  [[default]]
    background_darkness = 0.94
    cursor_color = "#aaaaaa"
    foreground_color = "#ffffff"
    scrollback_infinite = True
[layouts]
  [[default]]
    [[[window0]]]
      type = Window
      parent = ""
    [[[child1]]]
      type = Terminal
      parent = window0
[plugins]
stulluk ~ $  

So with such a clean & easy setup, I can split horizontally via CTRL+SHIFT+O and vertically via CTRL+SHIFT+K out-of-box, it starts maximised, it has infinite scrollback, its default theme is great for development & debugging…etc It is simply great. But terminator is written in python, and does not support GPU acceleration, so when you run some commands in terminal with thousands of lines of text ( such as dmesg or journalctl ), it is considerably slower than GPU accelerated terminal emulators, such as wezterm.

wezterm Installation

Linux

Under Linux, installing wezterm is as simply as going to this website: https://wezfurlong.org/wezterm/install/linux.html And then:

stulluk ~/Downloads $  wget https://github.com/wez/wezterm/releases/download/20240203-110809-5046fc22/wezterm-20240203-110809-5046fc22.Ubuntu22.04.deb
--2024-02-19 23:28:02--  https://github.com/wez/wezterm/releases/download/20240203-110809-5046fc22/wezterm-20240203-110809-5046fc22.Ubuntu22.04.deb
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/120568143/e14a7e4f-ff8c-4e2f-ba0d-4c7e3e53d554?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240219%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240219T202803Z&X-Amz-Expires=300&X-Amz-Signature=0bafa7dcd5c086764ce47baab676830328ebecaf16a97b5a47bba4fe0386d60f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=120568143&response-content-disposition=attachment%3B%20filename%3Dwezterm-20240203-110809-5046fc22.Ubuntu22.04.deb&response-content-type=application%2Foctet-stream [following]
--2024-02-19 23:28:02--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/120568143/e14a7e4f-ff8c-4e2f-ba0d-4c7e3e53d554?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240219%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240219T202803Z&X-Amz-Expires=300&X-Amz-Signature=0bafa7dcd5c086764ce47baab676830328ebecaf16a97b5a47bba4fe0386d60f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=120568143&response-content-disposition=attachment%3B%20filename%3Dwezterm-20240203-110809-5046fc22.Ubuntu22.04.deb&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.110.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 34300188 (33M) [application/octet-stream]
Saving to: ‘wezterm-20240203-110809-5046fc22.Ubuntu22.04.deb’

wezterm-20240203-110809-5046fc22.Ubuntu22.04.deb   100%[================================================================================================================>]  32,71M  11,4MB/s    in 2,9s    

2024-02-19 23:28:06 (11,4 MB/s) - ‘wezterm-20240203-110809-5046fc22.Ubuntu22.04.deb’ saved [34300188/34300188]

stulluk ~/Downloads $  sudo apt install ./wezterm-20240203-110809-5046fc22.Ubuntu22.04.deb 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'wezterm' instead of './wezterm-20240203-110809-5046fc22.Ubuntu22.04.deb'
The following packages were automatically installed and are no longer required:
  amd64-microcode intel-microcode iucode-tool libmono-addins-gui0.2-cil libmono-addins0.2-cil libmono-sharpzip4.84-cil linux-headers-6.2.0-35-generic linux-hwe-6.2-headers-6.2.0-35
  linux-hwe-6.5-headers-6.5.0-14 linux-image-6.2.0-35-generic linux-modules-6.2.0-35-generic linux-modules-extra-6.2.0-35-generic thermald
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  wezterm
0 upgraded, 1 newly installed, 0 to remove and 99 not upgraded.
Need to get 0 B/34,3 MB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /home/stulluk/Downloads/wezterm-20240203-110809-5046fc22.Ubuntu22.04.deb wezterm amd64 20240203-110809-5046fc22 [34,3 MB]
Selecting previously unselected package wezterm.
(Reading database ... 304184 files and directories currently installed.)
Preparing to unpack .../wezterm-20240203-110809-5046fc22.Ubuntu22.04.deb ...
Unpacking wezterm (20240203-110809-5046fc22) ...
Setting up wezterm (20240203-110809-5046fc22) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
N: Download is performed unsandboxed as root as file '/home/stulluk/Downloads/wezterm-20240203-110809-5046fc22.Ubuntu22.04.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
stulluk ~/Downloads $  

And then, create following file for configuration:

My Linux Wezterm Configuration

stulluk ~ $  cat .wezterm.lua
local wezterm = require 'wezterm'

local mux = wezterm.mux
local act = wezterm.action

wezterm.on('gui-startup', function()
 local tab, pane, window = mux.spawn_window({})
 window:gui_window():maximize()
end)

local config = {}
--- config.color_scheme = 'deep'
config.color_scheme = 'Dark Pastel'
config.font = wezterm.font('Ubuntu Mono', { weight = 'Regular' })
--- config.font = wezterm.font('JetBrainsMono Nerd Font')
config.font_size= 12.0

config.freetype_load_target = 'Light'
config.freetype_render_target = 'HorizontalLcd'

config.audible_bell = "Disabled"
config.disable_default_key_bindings = true
config.hide_tab_bar_if_only_one_tab = true
config.enable_scroll_bar = true

config.keys = {
  -- This will create a new split and run your default program inside it
  {
    key = 'e',
    mods = 'CTRL|SHIFT',
    action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
  },
  {
    key = 'o',
    mods = 'CTRL|SHIFT',
    action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
  },
  {
    key = 'C',
    mods = 'CTRL|SHIFT',
    action = wezterm.action.CopyTo 'ClipboardAndPrimarySelection',
  },
  {
    key = 'V',
    mods = 'CTRL|SHIFT',
    action = wezterm.action.PasteFrom 'Clipboard',
  },
  {
    key = 'V',
    mods = 'CTRL|SHIFT',
    action = wezterm.action.PasteFrom 'PrimarySelection',
  },
}

config.mouse_bindings = {
  -- Scrolling up while holding CTRL increases the font size
  {
    event = { Down = { streak = 1, button = { WheelUp = 1 } } },
    mods = 'CTRL',
    action = act.IncreaseFontSize,
  },

  -- Scrolling down while holding CTRL decreases the font size
  {
    event = { Down = { streak = 1, button = { WheelDown = 1 } } },
    mods = 'CTRL',
    action = act.DecreaseFontSize,
  },
}

return config


stulluk ~ $  

Of course you may need to install that font (JetBrainsMono Nerd Font).

Windows

Under Windows, installing wezterm is as simply as going to this website: https://wezfurlong.org/wezterm/install/windows.html download setup.exe and install

Since there is no native BASH shell in Windows, I install git for windows (with bash): https://git-scm.com/download/win

My Windows Wezterm Configuration

After wezterm installation is complete, create following config under C:\Users$your-user-name.wezterm.lua

local wezterm = require 'wezterm'

local mux = wezterm.mux
local act = wezterm.action

wezterm.on('gui-startup', function()
 local tab, pane, window = mux.spawn_window({})
 window:gui_window():maximize()
end)

local config = {}

config.default_prog = { 'C:/Program Files/Git/bin/bash' }
--- config.color_scheme = 'deep'
config.color_scheme = 'Dark Pastel'
--- config.font = wezterm.font('Ubuntu Mono', { weight = 'Regular' })
--- config.font = wezterm.font('JetBrainsMono Nerd Font')
config.font_size= 12.0

config.freetype_load_target = 'Light'
config.freetype_render_target = 'HorizontalLcd'

config.audible_bell = "Disabled"
config.disable_default_key_bindings = true
config.hide_tab_bar_if_only_one_tab = true
config.enable_scroll_bar = true

config.keys = {
  -- This will create a new split and run your default program inside it
  {
    key = 'e',
    mods = 'CTRL|SHIFT',
    action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
  },
  {
    key = 'o',
    mods = 'CTRL|SHIFT',
    action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
  },
  {
    key = 'C',
    mods = 'CTRL|SHIFT',
    action = wezterm.action.CopyTo 'ClipboardAndPrimarySelection',
  },
  {
    key = 'V',
    mods = 'CTRL|SHIFT',
    action = wezterm.action.PasteFrom 'Clipboard',
  },
  {
    key = 'V',
    mods = 'CTRL|SHIFT',
    action = wezterm.action.PasteFrom 'PrimarySelection',
  },
}

config.mouse_bindings = {
  -- Scrolling up while holding CTRL increases the font size
  {
    event = { Down = { streak = 1, button = { WheelUp = 1 } } },
    mods = 'CTRL',
    action = act.IncreaseFontSize,
  },

  -- Scrolling down while holding CTRL decreases the font size
  {
    event = { Down = { streak = 1, button = { WheelDown = 1 } } },
    mods = 'CTRL',
    action = act.DecreaseFontSize,
  },
}

return config

Note that I set bash to “C:/Program Files/Git/bin/bash” (backward slash!!) and disabled font config.

Here is how it looks under windows:

Closing words

I think wezterm is a nice terminal which fulfills all (except infinite scrollback) my personal requirements. However, I still love terminator, and except some corner cases, I feel it is still “just-enough” for my own use-cases. Maybe I will switch to wezterm one day, who knows :)



comments powered by Disqus