St – A simple terminal implementation for X
st.suckless.org
st.suckless.org
Not everybody wishes to use a terminal multiplexer in all cases, either.
They have to choose the feature set, and if other programs can provide a feature that some users want, that seems like a feature ripe for pruning. I think they made the right choice.
There are several reasons, but the biggest is that I'm pretty sure it's not possible to get more than a screenfull of text to my local X11 PRIMARY selection.
Also, I always use mosh for ssh (when possible) so that I can recover my connection if I run into network issues. Since mosh works by synchronizing a virtual screen, I don't get scrollback at all without tmux or the like.
Keep in mind that your terminfo has to support this, so make sure your ncurses-term package is the latest release from Jan 28.
I also made a patch for st to support OSC 52 propagation into Xorg, but it was rejected by the st maintainers because it uses base64 (as the OSC de-facto spec from xterm dictates).
The patch for st is however in a branch of the Wayland-fork of st
https://github.com/michaelforney/st/tree/selection
Another option if you use nested copies of tmux is to use this feature to get the remote clipboard into the local one, then yank with xclip.
[Edit] Assuming you have SSH configured to forward to your local X server [0].
Also, if your terminal emulator (rxvt, xterm on Linux and mintty on Windows) support OSC52 escape sequences for clipboard setting, this means you don't need X11 forwarding anymore, since you can set your X11 clipboard from tmux.
If anyone can help me get in touch with the libvte people, I want to patch OSC 52 support in there as well, since this is a great feature that should _not_ be relying on X11 forwarding or whatever.
It absolutely seems like very conflicting decisions user-experience wise.
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?
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.
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.
[1] https://www.gnu.org/software/screen/manual/html_node/Window-...
To make the argument that scrollback is bloat is insane if you at the same time add serial support but need scrollback for serial usage, so you use screen instead which had both serial support and scrollback.
Non-goals:
unlimited scrollback buffer (done by dvtm)Also, one should keep in mind that having to apply personal patches is perfectly acceptable for suckless software. In fact, for the very same st, to change font, colour scheme, or hotkeys/shortcuts - one has to edit config.h file and recompile. There is no traditional text config file or "Preferences" menu.
This might sound bizarre at first, but actually works as well as editing a text config file: config.h is very well structured and compilation only takes fraction of a second. Better yet, you're not constrained by opinions of previous commiters on what should be configurable and what - not. Which is the whole point, actually.
There's very little natural progression in computer use, people do things the way they know how until they decide to learn more. Think of how many time's you've seen some family member slowly select file-save without ever figuring out ctrl-s.
But in this case, I would disagree. The file is quite readable (way more than most text config files I've seen), and the single command to compile is even included in the README. If you're the kind of person that purposefully downloads a new terminal, rather than using the built-in one, you can probably configure st just fine.
I like to use the term "super-user friendly", as a compliment.
It does some tricks to do this (mainly the _main_ xmonad executable compiles a custom binary for you taking the xmonad.hs as input), but it's a different case.
http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Doc-Conf...
Yes, you can do simple stuff in xmonad without knowing Haskell. But for more complicated stuff, you have to either copy and paste code that you don't understand, or ask someone who knows Haskell to write it for you. And there's no way you're going to be able to do troubleshoot non-obvious problems without either knowing Haskell or once again asking someone who knows Haskell to do it for you. That's way too much of a pain in the ass.
Configuring and troubleshooting i3 doesn't require knowing Haskell, is really simple, flexible enough for what I need, and any advanced functionality I want it to perform I can program in my own language of choice.
Both custom patches and config.h changes can be saved in the package manager, which will then apply them automatically to new versions.
I don't get it. This patch increases the code base by merely 60 lines of code (104 insertions, 44 deletions).
Is 60 lines already considered bloat, in a verbose language like C?
Also, is this meant to lead to fewer complexity? Maintaining the patch separately from the code base is nothing but cumbersome. Essentially this is a long-time feature branch, which is a well-known anti-pattern regarding software quality and maintenance. What if there are more and more of such patches? What if they overlap and can't be applied together? In a central code base these formal conflicts would be resolved once and for everyone, early on.
I would have expected this feature (and its code) to be enabled/disabled by a single #define in config.h. That would be more consistent with the suckless philosophy of configuration. Or, reducing that bloat by simply enabling it always.
It's more about features. tmux and screen are widely used, so a lot of people won't need that functionality to be duplicated. Keeping extra features separate lets the users pick and choose what they want.
It's also worth noting that suckless's software is not meant for someone who wants a turnkey solution. It's meant to be customized by most every user.
Due to high code quality, removing even 10 lines is an achievement for suckless.org projects. Try it yourself and submit a patch to mailing list if you succeed.
> Also, is this meant to lead to fewer complexity? Maintaining the patch separately from the code base is nothing but cumbersome.
Maintaining feature as a patch prevents you from weaving it deep inside the code, adding hooks here and there just to make it work. It is harder to do, but it is the right way to make sure all feature related logic is kept in one place.
I have some pet suckless inspired projects. During development I introduced some useless features such as pthread support just because I learned about them. Then once I realized they are useless I removed them. It greatly improved code structure.
I'm used to achieve this by keeping each topic in a separate module (in C: function or file, in other languages: module, class, whatever). You'd then have clear entry points into that module.
Interestingly, the given patch isn't structured like that. So I'd argue that code would benefit from becoming a first-class citizen in the code base. As a patch it just gives the illusion of a well-separated feature. (Because a patch file is always a single file, no matter how much the changes are scattered around in the code base.)
> I have some pet suckless inspired projects. During development I introduced some useless features such as pthread support just because I learned about them. Then once I realized they are useless I removed them. It greatly improved code structure.
I fully agree that removing useless features does not only shorten, but simplify code. However, given that by far not everybody uses screen/tmux, I disagree with the "scrolling is useless" assumption here.
No, you don't have to recompile it. For shortcuts, sure, but I haven't used any st shortcuts besides font size +/-.
Colors can be changed via the shell e.g. https://github.com/chriskempson/base16-shell and the font is passed via the -f flag.
>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.
FIFY
Really? Generally accepted by who? My unscientific personal tests show that Gnome Terminal is the fastest and lightest VTE.
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.
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?
Another example: GNU vs BSD grep, from the author's mouth: https://lists.freebsd.org/pipermail/freebsd-current/2010-Aug...
Regex matching: 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.)
Note that while libvte seems to have greater throughput, its latency is terrible compared to xterm.
I think it's fair to say suckless code is clean and minimalist. But it definitely isn't suckless.
Secondly, it's all very tongue in cheek. After all it's aimed at the OpenBSD crowd and like minded people. It's not really meant to be taken literally by the general computing audience - not even within the wider FOSS community.
Lastly it's sad day for HN when negative comments get up-voted and positive comments defending niche software get down-voted. What happened to respecting our peers and acknowledging the massively wide range of personal preferences and usage habits?
I absolutely wasn't trying to be disparaging of them. I understand that there are people who love their work, and I love some of their software (dmenu).
My point was more toward the parent I was replying to - i.e., that the message from the suck-less crowd that other pieces of software "suck" is just an opinion. In the same way that they think (for example) the KDE desktop sucks, it's allowed to think that their products suck.
But I suppose that it can be seen as disrespectful, and I understand that. There is definitely room for airing one's opinion in a less inflammatory way.
Then again, if they name their project(s) "suck less", it's completely fair to say it sucks. If they can have arbitrary standards about what constitutes suckage, why not us?
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.
There is a general tabbing frontend that allows you to tab all sorts of applications: http://tools.suckless.org/tabbed.
In fact, I don't remember the details now but I recall looking at the source for another one of the suckless applications and finding some pretty inefficient algorithms. I think the other comment here about st being CPU-intensive with high output rates is an example of this.
Ironically, one of the reasons I think mainstream software sucks is because newer versions also tend to remove configurability and features often for the same goal of reducing bloat.
It's the same rationale that leads one to use a pen and paper rather than a note taking app.
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?
http://stackoverflow.com/questions/18731707/why-does-c11-not...
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/...
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.We hack so much into a text interface it's really easy to accumulate bugs.
I rarely (never?) see any "terminal glitching" except for the cases where I've done something absurdly wrong, like running a bash inside emacs-shell with the wrong setting for TERM.
Terminal emulation is essentially a solved problem (state machines and control code sets are small and well defined, there are many reference implementations and compatibility tests). If you see glitching, it's probably from what you're doing inside the terminal, not from the terminal itself.
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.
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.
I can imagine there could be bugs in esoteric terminal emulation, but for the typical use case of "TERM=xterm-256color" (or screen-256color) it works perfectly for my use case.
This appears to be true (from other comments on terminal performance in this thread) but other VTE-based terminals (gnome-terminal) have high performance and work great on sub-1GHz class machines.
xterm is a de facto standard, in that you can sit down in front of a machine which appears to be running some flavour of Unix, it doesn't matter if it's Gnome, KDE, TWM, CDE, etc., GNU or BSD or Solaris or whatever, you'll probably be able to find xterm and work out the rest from there.
Many devs/hackers use xterm as their day-to-day terminal, and seem to approximate ANSI control code compliance with "works in xterm".
The problem with this situation, as mentioned on the st page, is that xterm is unmaintained and unmaintainable.
st is trying to be a maintainable replacement, making improvements like vector fonts, and not being shy about ignoring legacy/niche/solved-elsewhere features.
- xterm is for exactly the case you describe: when all you have is "base X11" and you need a terminal. No crazy multi-gigabyte toolkit requirements. Its essentially a fallback/recovery tool for these cases, although I prefer just working on console when things get that bad.
- xterm's codebase is 30+ years old. "unmaintainable" seems like an overstatement, by a longshot.
For the vast majority of user-facing programs, run-time configuration is a must. A fancy GUI for it might be superfluous; a simple text file / command-line way to set options should always be available.
You can install software without a package manager.
Edit-compile-run is a rather complicated way to tune font size compared to a slider.
And on that note, while I admire ST for its simplicity, I've been a happy user of Sakura for the past few years (though, sadly not on windows 10... I've yet to find a really good console for w10).
https://launchpad.net/sakura (page down at the moment...)
Don't get me wrong powershell/the standard terminal is miles ahead of the old crappy cmd.com - but bundling a solid terminal would've gone a long way to pacify my desire to dual boot Linux (read:stop using w10) on my Surface pro.
If I weren't teaching students that run w10 on their own pcs, I would probably have relegated w10 to a vm/wine under Linux.
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.
Cool... Now I know that it's not just me that does this then. :)
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!)
More often options are changed on the shell (ZSH in my case) Then even more often on tmux.
Open ~/.xmonad/xmonad.hs. It's Haskell code, but frankly it reads like a configuration file, with a big list of shortcuts.
Edit the "code". You don't need to know Haskell, just follow the syntactic conventions you see there. Worst case, you have to search for configuration tips on the web.
Save xmonad.hs, hit the "recompile Xmonad" shortcut. You've now recompiled and restarted Xmonad, and all your windows are still where they were before. Application state survives recompilation.
Here's the changelog: http://invisible-island.net/xterm/xterm.log.html
xterm is addressing a vastly broader audience than st.
I might work on it someday.
It's still the best terminal emulator out there. Incredibly fast in software-only, even better when hardware accelerated, skinnable and configurable.
Also there is still some niche software that still requires it (for example IRAF which sadly is still going strong in the astronomy community).
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:
I would report this to the author but I don't see any way to do so.
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.
They're pretty big on "This is not #support. Post patch or GTFO" last I was there.
Notice the dotted zero in the top terminal (xfce4-terminal) and no dotted zero in the bottom terminal (st).
I suspect st is not recognizing the font name you're giving it, and to fix it you have to play around with different ways to telling st the name of your font. What worked for me for the Inconsolata font was "st -f Inconsolata" or "st -f Inconsolata:size=11".
Godspeed, I moved away from all suckless software because the developers are all massive jerks. They'll ignore your bug reports unless you spend an unreasonable amount of time doing intricate debugging, and if you refuse they'll be sure to remember your name and act hostile if you ever go back into their IRC. That's been my experience with Surf and something else (I don't remember what, but it wasn't st) anyways.
A few months ago I was having trouble with getting some TTF BIOS fonts recognized by urxvt and fc-list made me realize that I should've escaped a couple dashes in the font name.
/*
* appearance
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
static char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
Try to specify font name in this format.No screens there because there isn't anything to screen, it is just plain console without any GUI (supports scroll-back)
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.
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.
You can probably do something like it with urxvt's perl extensions. You could also just double-click to copy the path to the X primary selection and then use a keyboard macro to open the path in the primary selection in your file browser, or whatever.
- Quadruple-click smart selection
- "Selection respects soft boundaries" for selecting within a tmux pane
- "Rum coprocess" on keyboard shortcut, which allows doing stuff like http://brettterpstra.com/2014/11/14/safer-command-line-paste...
I just checked, and gnome-terminal doesn't even have split-pane. What do you guys use, anyway?
Selecting within a tmux pane: you got me on that one. I'm not aware of a terminal that does that, but again, it should be possible to do with urxvt's perl extension feature.
Regarding the "safer command line paste", Linux can do the same with bracketed paste mode.[1]
For splitting panes, I just use tmux, vim, or emacs.
If you're looking for things like toolbelt, or built-in regexp highlighting, or other (arguably nice) bells and whistles, I suspect most of them would be provided by separate utilities. (Yes, it's a distant echo of the "Unix way".)
Bookmarks in scrollback are neat, though, and cannot be easily added by a third party. I don't remember an implementation, though.
But then someone recommended Terminator and haven't gone back since :) It feels like gnome-terminal on steroids. Love the multipane stuff.
Extraterm -> https://github.com/sedwards2009/extraterm
The visual tour page explains some of the ideas present. https://github.com/sedwards2009/extraterm/blob/master/docs/t...
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.
#define LEN(a) (sizeof(a) / sizeof(a)[0])
I know precompiler magic is hard, and my C aint the bestbut 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...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.
which is why I use rxvt-unicode
There, I just saved you a ton of time :) Go read the next story.
And it depends on how you define "improvement" since this lacks features many would want. And I'm talking about features in native apps, not web-tech apps.