How to make your terminal suck less
Tags: st, linux, suckless
Published: 2019-12-06 22:46:10

There comes a point in any Linux user’s life where they have to figure out which terminal emulator to use. Chances are if you are using a desktop environment like GNOME (default with ubuntu) or KDE you’ve stuck with the stock terminal and not given it any thought, right? But doing this leaves a lot out when it comes to having a comfortable experience on Linux.

There are may options for terminal emulators, you could choose the slick-looking [Hyper.js](https://hyper.is/) or the GPU accelerated [alacrity](https://github.com/jwilm/alacritty) maybe even the utility-focused terminator. Each of these inherently has its pros and cons but ill have to say, in my mind, there is a terminal to rule them all - st.

st, also known as [suckless terminal](https://st.suckless.org/), is a small, lightweight, and fast terminal emulator from the [suckless community](https://suckless.org/). Before we talk more about st, we must talk about the driving force behind suckless. The suckless [philosophy](https://suckless.org/philosophy/) is to ‘focus on simplicity, clarity, and frugality. To keep things simple, minimal and usable‘ which means a lot for their programs, they are all fast light and efficient but on top of this, they have unrivaled modularity and customizability due to the simple, readable nature of their source code. This means that the members of the community can develop patches and changes independently of the master source code.

So why does this make st so good?
I’m glad you asked because there are a lotta things.

* It can run on anything
* It’s speedy as
* There are no messy config files
* It supports UTF-8 out of the box
* Clipboard support
* True 256 colors

To someone who hasn’t done much research around the topic, this all seems kinda lackluster, but when you find something like even the beloved URXVT has issues with the clipboard every feature you can get is a bonus. What makes this even more impressive is this

| Emulator | Lines of code |
|----------|---------------|
| xterm    | 65K           |
| urxvt    | 32K           |
| st       | <5K           |

How do I get started
Now, that’s easy, the steps are:

1. Clone the source repo
2. Make any config edits
3. Run sudo make install

# 1. Clone source repo

I have a GitHub repo with the patches I use applied e.g.

* follow URLs by pressing alt-l
* copy URLs in the same way with alt-y
* Copy the output of commands with alt-o
* Compatibility with Xresources and pywal for dynamic colors.
* Default gruvbox colors otherwise.
* Transparency/alpha, which is also adjustable from your Xresources.
* zoom/change font size
* copy text with alt-c, paste is alt-v or shift-insert
* and lots more view it [here](https://github.com/manfromth3m0oN/st)

## Download my fork with:

```
git clone https://github.com/manfromth3m0oN/st.git
```

# 2. Config edits
Now st does not have ‘traditional’ config files, this is because you don’t just download a binary and run it, you compile st from source. So to edit the config of st enter into the cloned folder with cd st Now open `config.h` with your favorite text editor (I recommend `nvim`). All of the options are commented so I won’t go over them here. There is nothing essential to change, unless you don’t use sh then you need to change the `static char *shell = "/bin/sh";` line to your appropriate shell (e.g. `ZSH`or `fish` etc)

3. Compile and install
This step is probably the easiest all you have to do is install with `sudo make install` This works provided you have `make` and `gcc` installed if you don’t just use:

```
    sudo apt-get install make gcc
    OR
    sudo pacman -S make gcc
    OR
    install make & gcc with whatever package manager you have
```

Now you can start using st
Now just start the st binary however your distro or wm/de does so for i3 edit your i3/config file

```
# start a terminal
bindsym $mod+Return exec st (or whatever *termname is in config.h)
```

# Closing thoughts
st is not a terminal built for someone who is brand new to the Unix ecosystem, but using it from the beginning can teach you a lot about how your system runs. Use st, and all the other suckless utilities for that matter, to help further your understanding of Linux so that you can be the most efficient user you can. After all, that is what the modern Linux philosophy is.

Thank you all for reading

~ M