Foot: a light terminal emulator🔗

🗓 In blog/ Sysadmin/

#c #terminal

It was probably about 5 ou 6 years since I used Kitty as my main terminal emulator software. For those who don't know, a terminal emulator is the piece of code that handle the display of text on the screen when you are in text mode. It is an emulation of a real hardware terminal which is a screen, a keyboard and its controler, a video controler, an input/output controler and logic electronics. A terminal takes the keyboard input, render it on the screen and send/receive text to or from the computer. A terminal is not a computer itself because there is no real CPU in it: it just transmits data to or from a computer and displays it.

A terminal emulator is generaly much more than an input/output program: it needs to handle size of the window and other features (copy/paste text, colors, scrolling, sessions, etc.).

The problem with kitty

Kitty is really nice: light, coded in Python and full of features. It was a good terminal emulator and I have never complained against it. But one thing I never saw before is a problem for small configurations that doesn't handle the minimum requirements about OpenGL. My Olimex Olinuxino is in that case. Under this machine, I could not launch kitty at all. Kitty requires recent version of OpenGL to work (ES 3.0 for embedded computers).

As I had a bunch of coding for this specific machine (retrolauncher), I had to find another candidate for a light terminal emulator running under wayland and able to run with SBC with an old version of OpenGL. After a bit of search I found the perfect candidate: foot.

My requirements are those ones:

And foot seems to be the perfect adequation with all of them.

My configuration of foot

Foot is already packaged under Debian (bookworm) and it comes with a bunch of themes. You have to install the following:

# apt install foot foot-themes

For the configuration, foot uses an ini file and honors XDG config files specification (which is cool).

# Foot configuration

[main]
# Police
font=Cousine:size=9

# I use dracula theme installed in foot-themes
include=/usr/share/foot/themes/dracula

[url]
osc8-underline=always

[cursor]
style=block
blink=yes

[mouse]
hide-when-typing=yes

[key-bindings]
scrollback-up-page=Control+Shift+Page_Up
scrollback-down-page=Control+Shift+Page_Down
scrollback-up-line=Control+Shift+Up
scrollback-down-line=Control+Shift+Down

I have just set a specific font with a size. dracula theme is included in Debian foot-themes. For the cursor, as a child of the eighties, it must be a block, otherwise, I can't see it. And it must blink, otherwise, I don't know if the computer is alive or not!

One feature that is really nice is the mouse pointer hiding when typing text. Sometimes, in Emacs, the view is already cluttered by a lot of information (lsp-mode) and the mouse cursor is another noise on the screen.

For the keybindings, I have set the same default configuration than in Kitty: you can't always defeat memory muscle easily.

For more details about the configuration options, feel free to read the dedicated manual:

man foot.ini

Using foot

Well, I can't say a lot: this is a terminal emulator: 99% of the time, I use it to do sysadmin. I push keys on my keyboard and it is displayed in the screen!

Actually foot is really light and fast: it does take less than 1% of a core for displaying lots of information (using top command), somewhat a little less than kitty. It displays things on the screen very fast but I can't really notice the difference with kitty. The only difference can be measured when you scroll a lot on the screen (a feature shared both by kitty and foot) and foot is really faster there.

One little drawback for me about foot is the way it handles urls. Most of the time, I would like to use the mouse. Foot uses a text mode selection for selecting which url to open. And as I probably use this feature less than 3 times a week, I constantly search about the keyboard shortcut for it (it is Ctrl+Shift+u). Most of the time, I need to copy/paste the url and I use the mouse for this.

Since 5 months as a daily driver for terminal emulation, foot just does the job really well: I haven't encountered a single crash or bad situation at all. And it is heavily tested: I always use 4 or 5 terminal windows at the same time.

I can say that I only use a very limited scope of the features included in foot. For example, I never use the server mode. Sway does it for me, and most of the time, a real foot session starts instantly, so I don't really need the speed improvement brought by the server mode. I don't use Emojis, nor Sixel pictures, nor on the fly font resize.

But now, I definitively have adopted it as my main and only terminal emulator, on every computer I own (a smartphone is not a computer: it lacks a real operating system). And I am really happy with it.

Screenshots

Foot terminal in action
Foot terminal in action

Foot displaying ncdu
Foot displaying ncdu

Foot displaying mmpNoise
Foot displaying mmpNoise

Conclusions

Foot is nice. I was already satisfied with kitty but it didn't work on all of SBC computers because of GPU acceleration. Foot was a nice replacement: small, very fast, coded in C, full of features, with an already packaged theme in my GNU/Linux distribution, XDG spec supporting, small ini file, easy customisable. It ticks all of my checklist about real good software.

I know it is really geeky to write an article for a terminal emulator. But it is probably the program I will use and interact with the most in my entire life, so it's very important to have a real good tool for this.

Furthermore, it is always fascinating to find there is still a lot of activity on the niche of terminal emulators. I find it fantastic that people are still involved on this subject, proving that it is still a fun and clever way to interact with a computer. For example, whenever I want to go back in the past, I use cool-retro-term and it feels like I am brought back to the eigthies with a C coding session on a an amber monochrome CRT monitor.