Termonad: A Terminal Emulator Configurable in Haskell

2018-11-15

Over the last couple months I've been working on a terminal emulator configurable in Haskell: Termonad.

Termonad is similar to other popular terminal emulators, but it is completely configurable in Haskell. It aims to be the "XMonad of terminal emulators".

Termonad is aimed at Haskellers who want a highly configurable terminal emulator.

Installation

Installation instructions for Termonad can be found in the README on GitHub.

Termonad is similar to XMonad in that you have your own Haskell configuration file (currently ~/.config/termonad/termonad.hs). When termonad launches, it uses GHC to compile your configuration file into a new termonad binary. It then re-execs that new binary. You get a brand new Termonad with all your own settings.

Usage

By default Termonad only has a few key bindings. The most frequently used are listed below:

Key Binding Action
Ctrl Shift t Open a new tab.
Alt (number key) Switch to tab number. For example, Alt 2 switches to tab 2.

The complete list of key bindings is available in the README.

Configuration

The Termonad configuration file is read from ~/.config/termonad/termonad.hs. You can find an example configuration file here.

Here are a few options that are currently configurable with Termonad:

  • terminal colors
  • font size and family
  • how to handle cursor blink
  • whether or not to show the scroll bar
  • whether or not to show the tab bar
  • how many lines to keep in the scroll back buffer
  • whether or not to show the File menu

Additional options can be found in the documentation for the Termonad.Config module.

Call-to-Action and Future Direction

If you're interested in Termonad, please feel free to tackle one of the open issues. I try to add lots of documentation to the issues, so they should be be easy to understand even if you are not familiar with the Termonad codebase. If you have any questions or want a clarification, please feel free to ask for help.

There are a couple issues that should be relatively easy to solve even if you're a beginner.

Here are a few issues that I would particularly like help with:

  • Add a way to enlarge font at runtime (#10)

    Currently, if you want to change the font size for a terminal, you need to restart Termonad. It would be great if there was a way to change the font size at runtime. This feature is pretty standard for terminal emulators, and it would make a good addition to Termonad.

    This should not be too hard to figure out.

  • Add search and find functionality (#13)

    There is currently no way to search for text within the terminal. This would also be nice to have. This is a little more involved than the above issue, but it still shouldn't be too difficult.

  • use gi-gtk-declarative (#79)

    Termonad is built on GTK, the widget library from the Gnome team. However, one of the most annoying things about hacking on Termonad is the haskell-gi family of libraries. These libraries wrap GTK to make it accessible from Haskell. This isn't a fault of the haskell-gi libraries, they are only thin wrapper over the underlying GTK libraries1.

    Working with the underlying GTK libraries requires performing many effectful operations in IO. This makes it hard to test, and even harder to reason about.

    There is a library called gi-gtk-declarative by Oskar Wickström which seeks to solve this problem. It makes GTK programming more like Elm or React, where the layout of your widgets is separate from the state transitions. It'd be neat to try to use this for Termonad.

    This would be quite a big change, but it would be interesting to do if you really want to help Termonad!

There are many other open issues if you're looking for something else to contribute to. There are even some nix-related issues if you prefer that over Haskell programming.

Conclusion

I have been using Termonad as my sole terminal emulator for a few months now. It should be very stable and ready for all your daily use. It could use a few more features, but it currently works well.

I want to give a big thanks to all the contributors up til now, especially LSLeary and Grendel-Grendel-Grendel, who have contributed extensive improvements.

If you have any questions or comments, feel free to create an issue on GitHub, or ask a question in the Termonad Gitter.

Footnotes


  1. This is a slight simplification. The haskell-gi family of libraries actually wraps a bunch of libraries from the Gnome team, not just GTK.

    Also, the author of haskell-gi is incredible helpful. Without his hard work and extensive help, Termonad definitely would not exist! Thanks Iñaki! If you're a Termonad user, you should buy Iñaki a drink next time you see him at an event!↩︎

tags: haskell