DEV Community

Max S-T
Max S-T

Posted on

How to make your terminal suck less

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 or the GPU accelerated alacrity 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, is a small, lightweight, and fast terminal emulator from the suckless community. Before we talk more about st, we must talk about the driving force behind suckless. The suckless 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

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. ZSHor fish etc)

  1. 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

Discussion (1)

Collapse
mareksamec profile image
mareksamec • Edited

Thanks for this article, I wish I had something like this when I started :D When I first stumbled upon st I felt like "No way I am gonna use st! No config, no docs, howtos". But once I learned how to do patching I started slowly creating my own build. It's actually quite comfy to edit the config.h and then just build it again. The comments in the code are actually quite explanatory.

Of course there are ton of disadvantages too. When you want to update to new version, you might need to do diff or re-apply your patches again if there are major changes etc. I am not sure if st will stay as my daily driver but I am definitely giving it a try. We live in a time of super bloated electron and snap apps. st brings total opposite of this. One minimal app, that has only minimal features and you can extend it with patches and make your own version. It might look extreme, but over time you might come to prefer it.