This page looks best with JavaScript enabled

Tabs in Alacritty

 ·   ·  โ˜• 3 min read  ·  โœ๏ธ  Firmin Martin

Introduction

Some time ago, I switched my daily terminal from kitty to alacritty due to issue regarding CJK input methods1. However, alacritty is known to not support tabs by design. There are at least two ways to enable tabs: through tabbed or tmux. Both are available in Ubuntu 20.04 package manager.

tabbed

tabbed is kind of a wrapper that will equip alacritty with tabs. To open alacritty with tabbed, use the following command:

1
tabbed alacritty --embed

Some notable keybindings:

  • Ctrl+Shift+Ret to open a new tab.
  • Ctrl+Tab or Ctrl+Shift+h / Ctrl+Shift+l to cycle tabs.
  • Ctrl+q to kill a tab.

tmux

tmux is probably one of the most-used terminal multiplexer. In tmux jargon, tabs are called windows. You may want to directly work under tmux. To do so, open alacritty with tmux:

1
alacritty -e tmux

tmux offers a bunch of features and customizability, but essentially, to just try out tmux windows feature, note the following shortcuts:

  • Create a window with C-b c.
  • Cycle forward/backward among windows with C-b n / C-b p.
  • Kill a window with C-b & or C-d.

Bonus: keep only one terminal instance

In my opinion, it’s not a good idea to keep multiple terminal windows: switching among them is quickly irritating. Personally, I bind Super+T to terminal and keep a single instance by using wmctrl. Concretely, combining up with the above commands:

  • For tabbed.

    1
    
    wmctrl -x -a "tabbed" || tabbed alacritty --embed
    
  • For tmux.

    1
    
    wmctrl -x -a "alacritty" || alacritty -e tmux
    

The commands check if there is a terminal instance, if so focus on it, otherwise create a new instance. You will have to wrap these commands in bash -c '<command>' if you want to bind them in Ubuntu settings (Keyboard shortcuts > Custom shortcuts). I use this tactic to bind the global keybindings I use 99% of the time: namely Super+C for browser, Super+E for Emacs and Super+T for terminal.

Conclusion

tabbed is light enough for people needing only tabs and no more. But I noticed some encumbrances making me switched to tmux:

  • Keybindings are hardcoded in config.def.h2, although you can easily change it and compile a local version, it might not be worth it.
  • Ranger image preview doesn’t work anymore.
  • The developpement is kind of inactive3.

  1. They actually work, but the feature is turned off by default. One has to enable it by setting the environment variable GLFW_IM_MODULE=ibus↩︎

  2. In my case, I bound in Vim C-q as :q! for years and was not ready to change it just for tabbed↩︎

  3. You might want to check out this fork for better support. ↩︎


Firmin Martin
WRITTEN BY
Firmin Martin

What's on this Page