
St – A simple terminal implementation for X - pmoriarty
http://st.suckless.org/
======
mikejmoffitt
I like the principles behind its design, but not supporting scrollback and
saying "that functionality should be provided by tmux or something similar" is
baffling when it's done in the name of removing bloat and complexity.

Not everybody wishes to use a terminal multiplexer in all cases, either.

~~~
jsjohnst
I can't believe they added serial line support and not scrollback. If you're
going to claim bloat, serial line support definitely ranks lower on priority
than scrollback.

~~~
nine_k
Likely they enjoy tinkering with hardware, so they just needed the serial line
support themselves.

~~~
josteink
With serial support, you definitely want scrollback, since you can't run GNU
screen (or tmux for the hipsters) during a HW bootsequence.

It absolutely seems like very conflicting decisions user-experience wise.

~~~
jstimpfle
What reasons are there not to use tmux over screen these days?

~~~
josteink
Plenty of reasons: Habits. Existing scripts. Muscle-memory. GNU/GPL over non-
GNU/GPL. To mention a few.

I've honestly not found a single feature in tmux which I need which isn't
already covered (and imprinted in finger-memory) by GNU screen.

On the flip side, I'd ask: What reason is there for a seasoned GNU screen user
to bother switching from something proven, and which works?

~~~
jstimpfle
These reasons are valid, but I'm more interested in technical reasons.

I switched to tmux when I needed to launch a lot of simultaneous jobs,
categorized in three sessions (starting in "active", moving to "success" or
"fail" when finished). I couldn't achieve it in screen at the time. The CLI
interface of tmux is not very intuitive and I think somewhat inconsistent
(maybe a bit like git?), but at least I could achieve what I wanted without
major compromises.

After a quick google search my impression is that running a shell command in a
particular GNU screen window is still painful.

~~~
josteink
> These reasons are valid, but I'm more interested in technical reasons.

Sure. And let's go full circle while we're at it: GNU screen supports
connecting directly to a serial device :)

Last I checked tmux doesn't.

------
cyborgx7
This thread is like every thread on suckless software ever.

>This software, which specifically states that it caters to a niche, doesn't
cater to my needs. I'm not going to consider thought that I might not be part
of the niche it's catering to and complain about it instead.

~~~
hncommenter_
>This thread is like every thread on HN ever.

FIFY

------
someheavyocean
As much as I love st, I had to stop using it recently. When using a bitmap
font in tmux, large amounts of text sent to stdout bring my computer to a
standstill. X is using 100% of a single core. I've switched to gnome-terminal
and the issue is gone.

~~~
nine_k
This, along with the generally accepted notion that Gnome Terminal is one of
the slowest with output, puts the whole minimalism idea under a serious
question. "Do one thing, but do it _well_ ", the saying goes.

~~~
otabdeveloper1
> the generally accepted notion that Gnome Terminal is one of the slowest with
> output

Really? Generally accepted by who? My unscientific personal tests show that
Gnome Terminal is the fastest and lightest VTE.

~~~
nine_k
You can run a completely unscientific experiment yourself: take a really large
text file, or just use `yes`, and time its full output on several different
terminals.

    
    
        yes | head -n 1000000 > two_megs.txt
        time cat two_megs.txt
    
    

You will definitely see a difference in the time it takes to complete or a
libvte-based terminal, xterm, urvxt, roxterm, etc.

OTOH I can google up posts saying that pt shows good results in comparisons
like that, apparently using a TTF font. Hopefully the bitmap font performance
problem is not due to the general design, but a regression in a special case.

~~~
davidshepherd7
Huh, interesting results on my machine:

    
    
        urxvt 0.233
        gnome 0.474
        st    0.515
        xterm 1:13.87
    

times are total real time, in seconds, seem repeatable from a few runs.

I was expecting st to blow everything else away given its focus on minimalism,
and what the hell is going on with xterm?

~~~
lvh
Minimalism is a tempting proxy for performance, but it often isn't. rg/ag/pt
aren't some of the fastest file searchers around because they're short and
don't pull cool tricks.

Another example: GNU vs BSD grep, from the author's mouth:
[https://lists.freebsd.org/pipermail/freebsd-
current/2010-Aug...](https://lists.freebsd.org/pipermail/freebsd-
current/2010-August/019310.html)

Regex matching:
[https://swtch.com/~rsc/regexp/regexp1.html](https://swtch.com/~rsc/regexp/regexp1.html)

(It's arguable that a backtracking implementation is not the simplest,
although I think it is -- and even if it is, a FSA compiler clearly isn't!)

And, finally: people tell me Clojure is slow, and I tell them that it lets me
write correct concurrent algorithms I understand. (See alioth shootout
results.)

------
satai
I can't help myself: suckless sucks. Lots of arbitrary limitations for the
code, need to recompile instead of configuration, optimizing for a wrong usage
scenario.

~~~
Jillboy
I find that most of their software is targeted towards beginner/intermediate
hackers. Having to recompile /forces/ you to tinker with the source code. When
I was learning how to code I would hack the shit out of my window manager
(dwm), I learned a lot of C in the process. When you think about it that way,
the "arbitrary limitations" on lines of code and everything else starts to
make sense.

I agree most of their stuff isn't targeted toward the average user, just this
small niche. Their browser, surf, doesn't even support tabs as far as I can
remember.

~~~
makafuro
> Their browser, surf, doesn't even support tabs as far as I can remember.

There is a general tabbing frontend that allows you to tab all sorts of
applications:
[http://tools.suckless.org/tabbed](http://tools.suckless.org/tabbed).

~~~
dhruvmittal
I've never used surf, but I really do like tabbed. It plays super nicely with
most tiling window managers I've used, and lets me get the single best feature
(ymmv) of i3 on xmonad.

~~~
pmoriarty
Could you elaborate on how you use tabbed with i3, and how it's better than
simply using i3's native tiling features?

------
jjnoakes
The code does unsafe things in signal handlers (vfprintf, for example), and
hides some things in macros that I wouldn't expect to see hidden (like the
assignment of the global "argv0" variable, defined in st.c, is assigned in a
macro from arg.h).

------
carmate383
It really is fantastic to see a new _improvement_ on something like a terminal
in 2017, that isn't written in Javascript / Coffeescript / Some other web
technology that deploys 100+MB of libraries.

~~~
auscompgeek
st has been around for a few years now. But yes, it's good to see a decent,
lightweight terminal emulator being somewhat actively maintained.

------
kookookabongers
I don't use C for a couple of years and I see this:

void ( _handler[LASTEvent]) (XEvent_ ) = { [ButtonPress] = buttonpress,
[ConfigureRequest] = configurerequest, [DestroyNotify] = destroynotify,
[EnterNotify] = enternotify, [LeaveNotify] = leavenotify, [KeyPress] =
keypress, [MappingNotify] = mappingnotify, [MapRequest] = maprequest,
[PropertyNotify] = propertynotify, [UnmapNotify] = unmapnotify };

What's this feature called?

~~~
bonzini
Designated initializers. It's in C99.

~~~
kookookabongers
Thanks. Oddly not in the C++ standard:

[http://stackoverflow.com/questions/18731707/why-
does-c11-not...](http://stackoverflow.com/questions/18731707/why-does-c11-not-
support-designated-initializer-list-as-c99)

~~~
buserror
Yes it's strange, it's one of the reason I stopped using C++ as a matter of
fact. Given the innate amount of code required in C++ constructor to
initialize objects, you'd think that would be very handy.

BTW, shameless plug, but my own simavr uses these C99 features as more or less
the whole basic structure on how multiple cores are described, see a sample
core declaration [0] for example. The beauty is that there is no code involved
in the declaration, it'll be 'const' too. Imagine the boilerplate you'd need
to do that in C++!

[0]:
[https://github.com/buserror/simavr/blob/master/simavr/cores/...](https://github.com/buserror/simavr/blob/master/simavr/cores/sim_90usb162.c)

------
charlesetc
I used st for a good year and it worked really well! I've switched recently
for features like the ability to change the font size without recompiling,
etc. Despite its spartan feature set, st is quite usable.

~~~
corybrown
What do you use now? Keyboard shortcut for font size change is a must for me.

~~~
pmoriarty
_" Keyboard shortcut for font size change is a must for me."_

From the st man page:

    
    
           Alt-Shift-Page Up
                  Increase font size.
    
           Alt-Shift-Page Down
                  Decrease font size.
    
           Alt-Shift-Home
                  Reset to default font size.

~~~
j605
Some don't read the man pages.

------
smlacy
Why do people care so much about terminal emulators and their supposed "bloat"
and "complexity"?

~~~
chrissnell
Bugs. When you work all day long in a terminal, you need it to be reliable. As
I mentioned above, xfce4-terminal is what I normally use but select-to-copy
doesn't work 100% of the time. This is super annoying. I'd switch to rxvt but
it has its own problems. Despite having had terminals for so much longer, *nix
has fallen behind macOS when it comes to terminal usability and reliability.

~~~
Ar-Curunir
Termite is pretty good and bug-free in my experience.

~~~
microcolonel
Plug: I maintain a fork of termite which doesn't require Daniel's patched VTE3
fork; and guts most of the exotic vimmy features.

I really like VTE's behaviour; even if the performance is a bit worse than
XTerm (though worlds ahead of what I've seen on OSX with iTerm2 and
Terminal.app). I rely on using iBus input methods in the terminal on a daily
basis, and VTE handles this wonderfully.

[https://github.com/xorgy/termite](https://github.com/xorgy/termite)

~~~
omtose
I've also gutted a lot of stuff from termite in my own fork (overaly, vi mode,
clickable urls) and it definitely makes for a lovely minimalistic terminal.
I'm thankful for termite being so simple (granted the lifting is done by a
lib) that this is possible without much effort.

I just wish I could log the scrollback buffer so that I could open an actual
editor on it, but I don't think libvte exposes anything to do this.

------
michaelmrose
Recompiling software to change options is utterly and totally ridiculous

~~~
laumars
Not that ridiculous from a developers perspective. All of the software I write
use hardcoded constants as config. Then once the app is stable and usable by
myself on production environments - and only at that point - do I consider
building in a config system or at least a few command line flags.

What's more, many developers (myself included) aren't afraid of jumping into
someone elses code and modifying it to behave how we want.

Let's also remember that a great deal of software you don't even think about
also runs this way; they'll have config flags to add and remove features at
compile time (run Gentoo or FreeBSD ports for a few weeks and you'll see what
I mean).

So having hardcoded options isnt that ridiculous nor uncommon on Linux.
However mainstream desktop distros do a good job at hiding that from their
users by picking sane defaults for them.

~~~
tokenizerrr
> Not that ridiculous from a developers perspective. All of the software I
> write use hardcoded constants as config. Then once the app is stable and
> usable by myself on production environments - and only at that point - do I
> consider building in a config system or at least a few command line flags.

Do you not build stuff that needs to run differently on production systems
than development systems? Simple things like credentials or connection URLs.

~~~
laumars
> _Do you not build stuff that needs to run differently on production systems
> than development systems? Simple things like credentials or connection
> URLs._

If you're building an MVP then the first and foremost concern is getting a
proof of concept product running. However to answer your question I don't
really see how editing list of constants in an AOT compiled language is any
worse than having to do the same in any of the hundreds of popular web
solutions written in languages like PHP where they often embed config as
source code variables. It's the same issues with hard coded settings in source
code but the difference is how your continuous integration pipeline / code
deployment scripts are configured. So it's quite an easy problem to solve once
you look at the deployment automation.

Obviously the end goal would be to have readable configuration files for
different environments. But pragmatically real world code often ends up being
rushed and hacked to meet deadlines rather than nurtured, following industry
best practices at every point throughout it's development cycle (assuming your
company even has a documented development cycle. Many don't!)

------
fiatjaf
That xterm README is from 1991. I believe it has improved a lot since.

~~~
davidgerard
It is also, in practice, actively maintained and gets bugfixes. It turns out
there are a metric buttload of obscure corner cases that do need to work
right.

Here's the changelog: [http://invisible-
island.net/xterm/xterm.log.html](http://invisible-
island.net/xterm/xterm.log.html)

xterm is addressing a vastly broader audience than st.

~~~
onli
Which btw was my problem with it when using st. Corner cases like using nano
under ssh just plainly did not work. Or copying stuff from the terminal that
got linewrapped, if I get that wrap as a linebreak in the copy buffer it
destroys the password I just copied, making it hard to use pass.

------
eriknstr
Personally I am enjoying terminology very much.

[https://www.enlightenment.org/about-
terminology](https://www.enlightenment.org/about-terminology)

~~~
xvilka
Sadly Terminology doesn't have support for 24bit RGB sequences (true color):
[https://gist.github.com/XVilka/8346728](https://gist.github.com/XVilka/8346728)

~~~
billiob
(main developer of Terminology here) As stated on
[https://phab.enlightenment.org/T746](https://phab.enlightenment.org/T746), it
is not an easy move due to the way the text grid is designed.

I might work on it someday.

~~~
mxvzr
unrelated: are you the billiob that used to contribute to aMSN back in the
days?

~~~
billiob
Yes, I am!

------
wtbob
This is my favourite terminal. I have it configured to run tmux, and couldn't
be happier. Lightning-fast, stable as can be, it gets out of my way and lets
me work.

------
residualmind
I've been using it as my main terminal for I think over 2 years, selected my
patches, tweaked it a little. Great hackable little thing with comprehensible
code.

~~~
Lapsa
same here. my only gripe is that it seemingly doesn't support firacode
([https://github.com/tonsky/FiraCode](https://github.com/tonsky/FiraCode))

------
welterde
xterm's support for the Tek graphics terminal is actually quite neat, since
you can use it with for example gnuplot to plot things over a (bad) SSH
connection.

Also there is still some niche software that still requires it (for example
IRAF which sadly is still going strong in the astronomy community).

~~~
datenwolf
Indeed it is and not just for that. When I developed the firmware for our my
company's laser product I exhaustively used the Tek graphics support for
debugging purposes. Kind of neat if you've got only a serial connection and
have to plot graphs. Much better than dumping it into a file and plotting it
with gnuplot.

------
chrissnell
Interesting. I've been wanting a better terminal for some time. rxvt is super
buggy, especially with clickable URLs. xfce4-terminal is better but select-to-
copy is flaky and doesn't always copy the text I select.

I really wanted st to work for me but something is wrong with the character
sizing when using Source Code Pro (17pt) as the font. I installed this on my
Arch laptop (a hidpi ThinkPad T460s) and something is seriously screwy with
the fonts. At top is xfce4-termina; on the bottom is st:

[http://imgur.com/a/8ALoS](http://imgur.com/a/8ALoS)

I would report this to the author but I don't see any way to do so.

~~~
schwarze_pest
> rxvt is super buggy

Which one are you using? AFAIK urxvt is the only maintained fork. I could be
wrong.

> I would report this to the author but I don't see any way to do so.

[http://suckless.org/community](http://suckless.org/community)

~~~
qu4z-2
You'll probably get yelled at to fix your font config if you report it,
though.

They're pretty big on "This is not #support. Post patch or GTFO" last I was
there.

------
unfamiliar
I find terminal emulators on Linux to be woefully inadequate after getting
used to iTerm2 on OS X. Can anyone recommend a Linux terminal emulator that
even comes close in terms of features and performance?

~~~
pmoriarty
What features do you need in iTerm2 that you find lacking in the Linux
terminal emulators you've tried?

~~~
donatj
I second this out of true curiosity. I have tried and never found any love in
my heart for iTerm2. It just feels clunky and bloated to me.

~~~
wruza
Last time I asked, someone said: "many features, but I like cmd-click to open
path". After reading [1] I see that all it does is loading hipster-oriented
"features" into your brain. Almost every feature is useless if you're doing
any amount of actual work with decent cli tools. But for playing a hacker it
is pretty cool.

[1]
[https://www.iterm2.com/features.html](https://www.iterm2.com/features.html)

~~~
kedean
There's nothing wrong with features that give you access to the wider
operating system. Like it or not, the modern operating system is more than
just terminals and CLI tools, and there's no reason to be condescending to
those who don't live exclusively in the terminal.

A large part of what makes iTerm2 popular is how well it works in tandem with
MacOS. Things like cmd+click to open (useful because you can use it on data
that was spat out from a previous command invocation), paste filtering, and
the fantastic built-in multiplexer/tabbing system.

That said, most of what makes MacOS users like iTerm2 just wouldn't be as
useful on any other operating system, because its so tightly coupled to the
wider OS.

~~~
wruza
I do not think that it does work well with OSX.

Autocompletion is on <⌘-;> (spell check) instead of <Esc>, and it works
strangely: "$ ls trunk/<cmd-;>" suggests other directories around trunk (like
tags and branches), when it should list trunk's contents. Cmd-click on path
cannot go to partial path. It also cannot "open in app", only in default app
(^cmd-click doesn't help). I always can select or triple-click and "$ open [-a
...] <cmd-v><cr>" to do that; or stop being fool and just type "open ." and do
whatever I need right in Finder. Colored tab's colors blend to barely visible
when deactivated. Changing color themes in settings does nothing at all.

I'm not arguing that features aren't needed. I'm arguing the hyping of little-
to-no working "features" that it tries to sell in place of REAL tools and
.files that were there for decades.

------
pizza
previous discussion:
[https://news.ycombinator.com/item?id=8661282](https://news.ycombinator.com/item?id=8661282)

------
hiq
Is there a full-screen mode? I often use it with gnome-terminal and the vim-
goyo plugin, it's pretty neat.

~~~
Lapsa
using i3 win+F here

~~~
hobarrera
THIS!

I wish apps would stop implementing their own fullscreen
functionality/hotkeys/etc, and we could all start relying on window managers
(or DE's) to provide this.

On-topic, I really like that if I super+F firefox, it actually behaves full-
screenish and hides the its bars. I wish most apps would do this.

------
daef
scrolling through
[http://git.suckless.org/st/plain/st.c](http://git.suckless.org/st/plain/st.c)
I stumbled upon

    
    
        #define LEN(a) (sizeof(a) / sizeof(a)[0])
    

I know precompiler magic is hard, and my C aint the best

but it makes me wonder if the parens at the end make sense - shouldn't it be
something like

    
    
        #define LEN(a) (sizeof(a) / sizeof((a)[0]))
    

also asked here [https://stackoverflow.com/questions/42001665/is-this-a-
plain...](https://stackoverflow.com/questions/42001665/is-this-a-plain-bug-or-
a-clever-precompiler-trick)

~~~
kv-1
i'm not saying that the way they wrote it makes sense, but you have to
remember that sizeof is actually an operator and not a function.

~~~
daef
just got basically the same answer on stackoverflow - sizeof is an operator ->
works w/o parens - makes sense - that's why i'm asking

------
hendry
I use st & I made a video about tmux since I am dependent on it :)
[https://www.youtube.com/watch?v=HCvFw3hfvxU](https://www.youtube.com/watch?v=HCvFw3hfvxU)

------
adamryman
I love using this terminal. It is extremely fast and does what it suppose to
perfectly.

Already have tmux which provides scollback, and I even get that in a try.

Only if surf was functional enough to be my daily driver.

------
nul_byte
> xterm is bloated and unmaintainable.

which is why I use rxvt-unicode

------
fb03
ITT: A lot of hate about suckless software and harsh ideological discussion.

There, I just saved you a ton of time :) Go read the next story.

------
hobarrera
st lack support for a fallback font, so I can't have emoji on my terminal, and
that really breaks my workflow because I'm sure I'll eventually need to see an
emoji on the terminal for some reason, so I've dedicated hours tweaking this
just to be ready for that moment.

~~~
abjectcircle
This should be accomplishable by tweaking fontconfig.

------
Zardoz84
I would keep using Konsole/Yakuake

