Alacritty and Byobu

April 2, 2020

I noticed the default Ubuntu terminal, my daily driver, has been feeling a little slow recently. Having heard about Alacritty, a fast new terminal written in Rust, I figured I might make the jump over and see what it was all about. The kicker, Alacritty doesn’t have tabs - this post dives into how I made the switch to a tabless world less painful.

Warning: I have not kept using Byobu. These instructions may or may not be relevant in 2023.

Installing Alacritty on Ubuntu was mostly straightforward but not entirely pain free, the recommended installation process is to clone down the repository, install cargo deb, and use it to install Alacritty from source.

Note: There is a snap image that seems tempting to install but ignore it - it’s very out of date. Warning: cargo install alacritty will not work, that package isn’t Alacritty-the-terminal, it’s some hello world application. It will conflict with the deb version you install if you install it by mistake, so uninstall it first.

Following the build and install process it’s recommended you run update-alternatives --config x-terminal-emulatorto switch the default terminal to Alacritty. Unfortunately I didn’t have much luck with that. The solution for me here was to run:

sudo gsettings set org.gnome.desktop.default-applications.terminal exec /usr/bin/alacritty

sudo gsettings set org.gnome.desktop.default-applications.terminal exec-arg "-x"

This followed by a logout mapped Alt+T to open Alacritty, awesome! At this point you can configure the look and feel of Alacritty with a ~/.config/alacritty.yml file, the template for which can be found attached as part of the GitHub release. There are lots of options - but I’ve only tweaked the theme.

#  Colors (Monokai Pro)
colors:
  # Default colors
  primary:
    background: "#2D2A2E"
    foreground: "#FCFCFA"

  # Normal colors
  normal:
    black: "#403E41"
    red: "#FF6188"
    green: "#A9DC76"
    yellow: "#FFD866"
    blue: "#FC9867"
    magenta: "#AB9DF2"
    cyan: "#78DCE8"
    white: "#FCFCFA"

  # Bright colors
  bright:
    black: "#727072"
    red: "#FF6188"
    green: "#A9DC76"
    yellow: "#FFD866"
    blue: "#FC9867"
    magenta: "#AB9DF2"
    cyan: "#78DCE8"
    white: "#FCFCFA"

#Solving The ‘Tab’ Issue

I’ve been a user of Ubuntu’s default Terminal application for years now and the thought of not having tabs is a little painful. Alacritty recommends using tmux for your window management needs and having tried it out, by default it’s quite an awkward and clunky experience for someone who hasn’t used a window manager. Fortunately, I discovered byobu - a terminal window manager with sensible defaults that uses tmux for its backend.

To get it working for me there were a few configuration options I had to tweak. Firstly, byobu-config lets you turn off most of the annoying status bar items at the bottom (I prefer startship). By default, the keybindings heavily use the Fn keys that I don’t have within easy reach on all my keyboards, I also missed the muscle memory for creating tabs and switching between them. I added a ~/.byobu/keybindings.tmux file to replicate some of the keybindings I was familiar with. This file uses tmux keybinding syntax, you can see the default keybindings at /usr/share/byobu/keybindings/f-keys.tmux.

My file looks like:

bind-key -n C-t new-window -c "#{pane_current_path}" \; rename-window "-"
bind-key -n C-q kill-pane

bind-key -n C-S-Left previous-window
bind-key -n C-S-Right next-window
bind-key -n C-PgUp previous-window
bind-key -n C-PgDn next-window

unbind-key -n C-a
set -g prefix ^A
set -g prefix2 F12
bind a send-prefix

Finally, to replicate the mouse wheel scrollback that I’m used to (rather than using a special mode for it) I added a file ~/.byobu/.tmux.confg and included set -g mouse on.

To reload byobu’s config press F5 and the changes should immediately kick in.

See Also

Last Updated: 2022-04-06 13:57