XTerm: It's Better Than You Thought
aduros.com
aduros.com
I've been using Xorg in one form or another since 2005-2006 and frankly since we all got automatic configuration and said godbye to Xorg.conf it's been a very very pleasant experience.
I've been using both nVidia and intel cards, 1/2/3 monitors (in various arrangement) and network stuff (ssh -X and similar), and a videogame from time to time.
Even xterm, with the right fonts, it's a very nice setup. I almost can't see the difference between a gtk emacs window and an emacs session running in xterm-unicode with proper fonts and antialiasing.
Xorg might not be "optimal", but it works very well for me and I won't be switching to anything else until a wayland or whatever reach feature parity (including but not limited to network transparency).
Whatever,
That's because DonHopkins is shitposting quotes from the Unix Haters Handbook, which came out in 1994 and contains gripes about Unix dating back to the 80s.
The Unix ecosystem, including X11, evolved a teensy tiny bit since then.
Do you know any computer/user interface that is based on writing what you want to do? (instead of selecting it from a small list of possibilities) The only one that I know is the "primitive" command line.
No need for more modern examples.
Every piece of software (Excel? Word? Outlook? Autocad? Photoshop?) has its own system of automation if it has one at all, with many of the skills complicated to learn on one hand, and not transferable on the other. On tablets, automation is essentially nonexistent.
Whereas on Unix, there's a mostly-unified system of automation (shell), with mostly transferable knowledge.
If there is nothing in your work that benefits from automation, you wouldn't care. But you'd also be rather special, IME - most people spend a lot of time on recurring and automatable actions they gain no benefit from repeating manually.
Those are useful and beautiful, but they are particular cases of "command lines", aren't they? A bit limited, in that they are only useful for developing on that IDE, and not as a general interface for your computer, but useful command lines nonetheless. I thought you were opposed to command lines.
Yet, is it possible to use siri or alexa for all your computing needs? Can you copy files around, convert a few images from tiff to jpg, download, compile and set up a nginx web server, hack a bit the code of the server and recompile, etc.? Because I can do all of that from the comfort of my "obsolete" command line.
I use my terminal and shell all day. :P
Hopefully we're getting there though!
Xorg is stable and proven for decades; Wayland has been incomplete and buggy for decades.
I don't run Wayland, PulseAudio, DBUS, or SystemDumpsterFire on my system, and don't miss any of them.
I don't run strange binary code on my system either, so keyloggers aren't really a concern.
I find it ironic that people who routinely shovel foreign binary code onto their system (even automatically downloading and installing it, no less) from untrusted and untrustworthy third parties, are so all-fired concerned about these trifling imagined Xorg security problems.
- https://news.ycombinator.com/newsguidelines.html
Please, let's not reduce the level of discussion over here. Let's keep this respectful.
I have deliberately chosen to keep my answer to the OP on point, even though I disagree just as strongly.
I'm not going to ban you because you've mostly been posting good comments lately, which is cool. But comments like this do more damage than good comments add value, so please don't do that anymore.
If you wouldn't mind reviewing https://news.ycombinator.com/newsguidelines.html, we'd be grateful.
! Convert Meta-x into "ESC x", not "ø"
XTerm.VT100.metaSendsEscape: true
! Allow HT (TAB) in paste; i.e. do not convert to space character
XTerm*VT100.DisallowedPasteControls: BS,DEL,ESC
! Assume window titles are UTF-8 encoded
XTerm.VT100.utf8Title: true
(Add to your ~/.Xresources and/or ~/.Xdefaults file.)To the best of my knowledge, one downside is the text rendering is synchronous. Read a character off the tty, try to display it on the screen. It's fine until you go and cat /dev/mem or something like that. Many GNOME-ish terminals use vte which drops frames if it can't keep up rendering.
I also run into problems with bad display managers or DEs that don't load ~/.Xresources or ~/.Xdefaults (looking at you Debian gdm).
I find this to be a feature, it's part of what makes xterm a terminal emulator.
There's a speedhack in recent xterm that makes it behave more like libvte, but I forgot the incantation to enable it.
Cannot you that with Xterm too?
XTerm*fastScroll: true
If you want the same sane behavior for vim, add "set t_ti= t_te=" to your .vimrc.
With Kitty, which I've been playing with and doesn't support titeInhibit, it requires deploying a termcap package everywhere, which is also painful, but I ended up building a version with those escape codes removed, which was kind of a benefit of having to use and deploy a custom termcap.
While Hackernews was busy grooming their Alacritty setup and holding drag races between it, iTerm, and whatever bloated terminal Microsoft came up with to see which could cat a huge file the fastest, I've been just using xterm. xterm -- it's the standard terminal emulator.
xterm:
* actually emulates a terminal and passes a set of compliance tests to determine how VT-compatible a terminal is (other TEs emulate xterm, poorly)
* is still compatible with bitmap fonts
* has a reputation for being slower than other TEs, but that's only because by default it doesn't cheat and commits every screen update. Other TEs, in order to increase their chances of winning the drag race, will skip updates they think you won't see. This can be enabled via a command-line option or X resource in xterm, but makes xterm less compatible.
* comes with every Linux or BSD distro and works fast on nearly any graphics adapter
I'm not familiar with the history, but I guess this is essentially referring to a standard defined by hardware products from the 1970s? Why is that still relevant?
It is a software standard, influenced by hardware, which has outlasted nearly every other hardware and software standard of its time. Doesn't that strike anyone else as bizarre?
Example: I once worked for a robotics firm that built its own custom batteries. The battery engineers wanted an easy way to monitor battery health and status. So they added code to the firmware to make the tiny microcontroller that monitored and controlled the battery to periodically spit out screenfuls of health information in VT standard. Then, all they had to do was attach a laptop to the battery over serial and start up Windows HyperTerminal, and they had a full (text mode) status display.
This could not be done so easily without a terminal standard that's nearly universally recognized.
I can only get consistent screen output if I use Xterm. rxvt, Alcrtty (sp?), Konsole, Gnome Terminal and all others that I have tried mungle ncurses, and/or other screen decorations (like using ASCII +------+, or TAB/Space, "decorations").
Even if I do get rxvt dialed in from one client, if I connect from a different workstation with a different client it's all a mess again.
I know xterm is the slowest of the bunch, but it always works with minimal putzing.
I though that Xterm was the fastest in terms of latency and configured adequately, pretty going dealing with big amounts of text:
https://anarc.at/blog/2018-05-04-terminal-emulators-2/
Xterm*fastScroll: true
I am really grateful for Xterm, it is a great default for all my machines.
This boggles my mind. What on earth does a windowed terminal need to do that should result in any latency on a modern machine?
We had full ANSI-addressible displays that ran faster than the eye could read over serial lines in the 1980s. What on earth additional does a terminal program do and why would I want that?
The internal processor that does nothing but scan my laptop's keyboard to send events to the "computer" is more powerful than the setup we used to have. Yet the entire thing is slower.
My Mac doesn't draw any faster than the Alto I used in the 70s.
Yes it absolutely does, you just don't notice because of the increase in fidelity. What was then 640x480 pixels is now a 4K display. The total number of pixels is several orders of magnitude more, the number of colors is now 16.7 million rather than 256, and the complexity of the scene has increased where we now have anti-aliased text and alpha blending.
Yours is the first comment to actually address my question.
Want to skip font selection? No emojis for you.
Want to skip glyph selection? No ligatures or Arabic or Devanagari text for you.
Want to skip text layouting? No Right-to-Left support for you.
There is a whole crapton of legitimate complexity in the font rendering stack because we don't want to have the constraints of the 70s anymore (only 256 glyphs, fixed font size, monospace font only).
(Sidenote: For those of you who think "I'm fine with monospace fonts in my terminal", I am using a monospace font as well. But "monospace font" only means that all ASCII glyphs are equal-sized, which is a tiny minority of all glyphs a Unicode font supports. I have grown a very strong opinion regarding this topic since I started to learn Japanese and hence want to be able to deal with CJK characters.)
What I would like to see is a terminal that has a default high-performance monospace-only rendering engine, but gracefully and dynamically switches to a different rendering engine that supports the full-blown text layout capability once the terminal detects some input that makes use of these features.
The Nongraphical GUI
XCalc After Several Resizings
https://miro.medium.com/max/434/0*LIDAYbj5NRANRGl7.gif
X was designed to run three programs: xterm, xload, and xclock. (The idea of a window manager was added as an afterthought, and it shows.) For the first few years of its development at MIT, these were, in fact, the only programs that ran under the window system. Notice that none of these program have any semblance of a graphical user interface (except xclock), only one of these programs implements anything in the way of cut-and-paste (and then, only a single data type is supported), and none of them requires a particularly sophisticated approach to color management. Is it any wonder, then, that these are all areas in which modern X falls down?
Ten years later, most computers running X run just four programs: xterm, xload, xclock, and a window manager. And most xterm windows run Emacs! X has to be the most expensive way ever of popping up an Emacs window. It sure would have been much cheaper and easier to put terminal handling in the kernel where it belongs, rather than forcing people to purchase expensive bitmapped terminals to run character-based applications. On the other hand, then users wouldn’t get all of those ugly fonts. It’s a trade-off.
[1]http://www.art.net/~hopkins/Don/unix-haters/x-windows/disast...
http://www.art.net/~hopkins/Don/unix-haters/login.html
Here's my not-so-subtle Solaris joke about how AT&T was ruining Unix:
Thanks for coming out, the X Windows Chapter was my favorite in the book. :)
https://www.amazon.com/UNIX-Haters-Handbook-UNIX-Haters-line...
Or just download the pdf file:
And at the same time, a web browser is the client of computing and data servers in the cloud, provided over the network.
In reality, there can be many different client/server relationships existing in different directions over the same full duplex network connection. It's really a bi-directional multiplexed messaging channel, not a pure strict hierarchical relationship, and many client/server dependencies can go both ways over the same connection, at the same time. You can even run an ssh that opens tunnels in both directions, then tunnel X and http connections over that.
Once a connection is established, it really don't matter which end initiated the connection (or how many links and proxies and tunnels there are along the way) -- you're just sending messages both ways.
"Client/Server" is an over-simplified way of describing what's possible.
Within the context of the X Window System, the server is the body of code responsible for delivering the display to the user viewing it.
The server actually serves the user to the remote client.
It's like "you are not the customer, you are the product". The remote program needs to communicate graphically with you, and connects to the X server to do this; therefore, you are not the requester of a resource, you are the resource being served. :)
Cheers.
I have a 4K display and terminal has it's own virtual desktop, separating a Konsole window into nested tabs is a must to simplify the navigation between tabs since you can switch to other groups by a single hotkey.
I use profiles to visually differentiate tabs for different purposes (e.g. ssh to hosts with master and replicas of DBMS, which I did years prior to [0] happened), some made for fixing production hosts so they have an infinite logging enabled, and one can alter hotkey schemes with those.
Alarms are just an easy way of triggering a notification when a task is done or failed, saves time and brain resources.
Not to say your setup is deficient, but I think I understand where the parent is coming from.
Have you tried duc for disk usage? It's minimal and has a nice visualizer.
I settled on xdiskusage and gt5 (the latter when I'm on a terminal). Both great tools.
It made my experience on high DPI screens far better. You can find it packaged up in the usual places (e.g. Debian).
I'd been using urxvt w/ a plugin for tabs for eons previously. I'be been mutating my tmux config to match the urxvt + screen binding I've been used to.
bind -x '"\C-T": _terminal_here'
I would love to know how to execute a command from Xterm directly, I am sure that it is possible.
XTerm.vt100.translations: #override \n\
Ctrl <Key>T: spawn-new-terminal()I don't understand this - isn't all rendering on a typical macOS or Linux desktop done via the GPU?
Ctrl <Key> minus: smaller-vt-font() \n\
Ctrl <Key> plus: larger-vt-font() \n\
Ctrl <Key> 0: set-vt-font(d) \n\
And 2 other config options to help reduce trailing spaces when selecting text: xterm*highlightSelection: true
xterm*trimSelection: trueI'll swap you for these. I don't want any automatic opening of URLs, but I do want to make it easier to copy-paste them:
xterm*on3Clicks: regex [^ ''""()<>$+]*
xterm*on4Clicks: line
xterm*on5Clicks: groupXterm should support sixels out of the box but needs further configuration to make it work properly:
XTerm*decTerminalID: 340
XTerm*numColorRegisters: 256
If you want to scroll the content in alternate screens like less instead of the scrollback buffer with your scroll-wheel you have to enable: XTerm*alternateScroll: true
If you want a subtle and less jarring visual terminal bell you can enable this option which flashes only the current line and not the whole screen: XTerm*visualBell: true
XTerm*visualBellLine: true
XTerm*visualBellDelay: 20I use the terminal everything and even my IDE.
Give me all the fancy features and dream up more.
Just actually support vt100 when it is needed and in sometimes worse situations.
Our “serial” console solution is even worse then the old school days. God help us if we need to use it for more then the occasional evaluation.
xterm -cmI've seen it used for a modem dial-up program and I've seen it used for the emulation of old computers with serial consoles. It would probably find use with debuggers. Sometimes you just want to pop open a new window, and xterm is the only terminal emulator that will cooperate.
The option parsing is buggy. Only file descriptor 0 works, but that is good enough because of the dup2 system call. Fork, set up the file descriptors, and then exec an xterm like so: xterm -S/0 -T foo -n foo -name foo
I'd love to get the feature, with the exact same syntax, into all the terminal emulators. That would mean that x-terminal-emulator, which is a link to whatever the user installed, would always have the feature.
Do sudo "apt-get install suckless-tools", then run this command to have a tabbed xterm:
tabbed -c xterm -into &
Press Ctrl+Shift+Enter to open a new tab and Ctrl+Q to close a tab. You'll find more info in the man page for tabbed.It doesn't support most(any?) of the bleeding-edge sequences for hyperlinks and underline styling.
It may have better input latency than xfce, but what are you running it on, a 486? Maybe for RPi, but—it has poor paint performance as well. It will flash if you try to do animation or scroll a complex screen. Bit of a toss up on the that front.
Anyway I find it useful for testing terminal sequences, but it's a tough sell as a daily driver. Things like tabs and a proper scrollbar are a minimum for me.
I use xterm in tmux, no need for native scrollbar or tabs.
Tabs I agree that it may be a showstopper for some, however in X you can use suckless tabbed to add support:
https://tools.suckless.org/tabbed/
For some of us, we just want the fastest terminal out there (in latency and startup), because everything else will be taken care by the window manager or Tmux.
I don't especially recommend it either, but I like it a lot for my own use. People who don't know how to patch C on Linux are probably not really going to want to use it with the default config.
- xterm just gives up (tried uxterm as well as the .Xresources settings here)
- st prints the arabic backwards (left to right, which I suppose you might prefer if you don't actually plan on reading it), has no colour on the emoji (which again you might prefer!), and completely fails to display the double-composed diacritics (this is a bad one, even if you prefer to KISS)
- I don't know what kitty is doing with the arabic, all I see are some strange rendering artifacts
- sakura (and xfce4-terminal) passes all the tests
The only application for it that I found was a previewer for TeX's dvi files that could render on the Tektronix terminal by drawing a lot of tiny horizontal lines.
I used urxvt from ~2011 until a couple of months ago and I have been really liking the speed and simplicity of xterm since then.
Background transparency is the one feature keeping me from considering xterm. I like the URL handling hack in OP, but I'm also a bit married to some urxvt plugins (URL handler, trimming whitespace when copying)
I think the entirety of my ~/.xresources xterm config is
#include ".Xresources.colors"
!! xterm
! https://invisible-island.net/xterm/
! https://linux.die.net/man/1/xterm
!XTerm.vt100.faceName: Monaco:pixelsize=11
XTerm.scrollTtyKeypress: true
XTerm.scrollTtyOutput: false
XTerm.utf8: true
XTerm.vt100.boldMode: false
XTerm.vt100.locale: false
XTerm.vt100.scrollbar.width: 8
XTerm.vt100.scrollBar: true
XTerm.vt100.utf8: true
I'll try to take a video of the difference at some point — I use xorg 1.20.8 on macOS 11.1 and it definitely feels noticeable when I type quickly with vsync disabled (through Quartz Debug.app).> Background transparency is the one feature keeping me from considering xterm.
That's fair. The macOS xorg server has never supported the COMPOSITE extension/xcompmgr/compiz, so transparency/compositing have always been out of the question for me.
> I like the URL handling hack in OP, but I'm also a bit married to some urxvt plugins (URL handler, trimming whitespace when copying)
I sympathize with this — I used urxvt for years and grew to like how it could easily extend itself using perl. Thankfully, I have been able to mirror all of my urxvt functionality in xterm since I switched back. It also helped me simplify my ~/.xresources, which shrank from ~300 lines 10 years ago to 50 (for both my xterm and urxvt configs excluding color definitions, which live in ~/.Xresources.colors).
For comparison, rxvt-unicode has perl utils for mouse-less URL selection [1]. Since it's operating within the terminal, scrollback is also available for selection (not just the currently visible screen).
After invoking the selection mode, it's as easy as using j/k to choose the URL and Enter to open or y to yank to clipboard. Installed on Arch with the `urxvt-perls` package.
Date: Wed 10 Apr 91 08:14:16 EDT
From: Steve Strassmann <straz@media-lab.mit.edu>
To: UNIX-HATERS
Subject: the display from hell
I have a “window system” on my unix box. You see, in the unix world, “system” means “a bunch of unrelated programs.” But that’s not what I want to talk about here today. I want to talk about overlay planes.
My HP 9000/835 console has two 19" color monitors, and some extremely expensive Turbo SRX graphics hardware to drive them. You’d think that I could simply tell X windows that it has two displays, the left one and the right one, but that would be unthinkably simple. After all, if toys like Macintoshes can do this, unix has to make it much more difficult to prove how advanced it is.
So, what I really have is two display devices, /dev/crt0 and /dev/crt1. No, sorry, I lied about that.
You see, the Turbo SRX display has a graphics plane (with 24 bits per pixel) and an overlay plane (with 4 bits per pixel). The overlay plane is for things like, well, window systems, which need things like cursors, and the graphics plane is to draw 3D graphics. So I really need four devices:
/dev/crt0 — — the graphics plane of the right monitor
/dev/crt1 — — the graphics plane of the left monitor
/dev/ocrt0 — — the overlay plane of the right monitor
/dev/ocrt1 — — the overlay plane of the left monitor
No, sorry, I lied about that.
/dev/ocrt0 only gives you 3 out of the 4 overlay bits. The fourth bit is reserved exclusively for the private use of federal emergency relief teams in case of a national outbreak of Pixel Rot. If you want to live dangerously and under threat of FBI investigation, you can use /dev/o4crt0 and /dev/o4crt1 in order to really draw on the overlay planes. So, all you have to do is tell X windows to use these o4 overlays, and you can draw graphics on the graphics plane. No, sorry, I lied about that.
X will not run in these 4 bit overlay planes. This is because I’m using Motif, which is so sophisticated it forces you to put a 1" thick border around each window in case your mouse is so worthless you can’t hit anything you aim at, so you need widgets designed from the same style manual as the runway at Moscow International Airport. My program has a browser that actually uses different colors to distinguish different kinds of nodes. Unlike a PC Jr, however, this workstation with $150,000 worth of 28 bits-per-pixel supercharged display hardware cannot display more than 16 colors at a time. If you’re using the Motif self-abuse kit, asking for the 17th color causes your program to crash horribly.
So, thinks I to myself cleverly, I shall run X windows on the graphics plane. This means X will not use the overlay planes, which have special hardware for cursors. This also means I cannot use the super cool 3D graphics hardware either, because in order to draw a cube, I would have to “steal” the frame buffer from X, which is surly and uncooperative about that sort of thing. What it does give me, however, is a unique pleasure. The overlay plane is used for /dev/console, which means all console messages get printed in 10 Point Troglodyte Bold, superimposed in white over whatever else is on my screen, like for example, a demo that I may be happen to be giving at the time. Every time anyone in the lab prints to the printer attached to my machine, or NFS wets its pants with a timeout, or some file server threatens to go down in only 3 hours for scheduled maintenance, another message goes onto my screen like a court reporter with Turett’s syndrome.
The usual X commands for refreshing the screen are helpless to remove this incontinence, because X has no access to the overlay planes. I had to write a program in C to be invoked from some xterm window that does nothing but wipes up after the mess on the overlay planes. My super 3D graphics, then, runs only on /dev/crt1, and X windows runs only on /dev/crt0. Of course, this means I cannot move my mouse over to the 3d graphics display, but as the HP technical support person said “Why would you ever need to point to something that you’ve drawn in 3D?”
Of course, HP claims X has a mode which allows you to run X in the overlay planes and “see through” to the graphics planes underneath. But of course, after 3 months of calls to HP technical support, we agreed that that doesn’t actually work with my particular hardware configuration. You see, I have the top-of-the-line Turbo SRX model (not one, but two on a single workstation!), and they’ve only tested it on the simpler, less advanced configurations. When you’ve got a hip, forward-thinking software innovator like Hewlett-Packard, they think running X windows release 2 is pretty advanced.
I never figured why that is, other than it not being a CPU issue.
Edit: I found this at the arch wiki:
Troubleshooting - Flickering on scroll
Warning: Double buffering may cause non-bitmap fonts to render incorrectly.
Rebuild xterm using ABS and include the --enable-double-buffer flag:
./configure --prefix=/usr \
...
--with-utempter \
--enable-double-buffer
Could be more friendly.I never understood why so few people are bothered. These blurry fonts hurt my eyes.
xterm -bg '#bebebe' xterm -bg \#1A1B1C -fg whiteFor a fast terminal with Wayland support, check out `alacritty` or foot:
https://codeberg.org/dnkl/foot
`foot` (foo terminal) benchmarks faster than alacritty and offers a client/server mode for even faster startup for new terminal windows.
https://medium.com/@donhopkins/the-x-windows-disaster-128d39...
X has had its share of $5,000 toilet seats — like Sun’s Open Look clock tool, which gobbles up 1.4 megabytes of real memory! If you sacrificed all the RAM from 22 Commodore 64s to clock tool, it still wouldn’t have enough to tell you the time. Even the vanilla X11R4 “xclock” utility consumed 656K to run. And X’s memory usage is increasing.
Nobody in 2021 is talking about Sun Open Look. And even that, whatever its faults at the time, was probably less resource intensive than what most HN readers would use to build a UI today. Try running electron on an Open Look era machine.
What I'd expect to find is some description of the security guarantees they provide, and some active work (such as fuzzing with hostile clients), and tracking of found & fixed vulnerabilities.
Of course, security is subject to implementation details. But as far as I know, the protocol is sound, and I can't recall vulnerabilities.
How each implementation handles theirs is up to them. At least, we have multiple implementations of the protocol. With X, not so much.
Having multiple young codebases implementing the spec doesn't really provide security assurance at this point, though it can have other benefits.
It even comes with a fancy (but rather simple) extension for displaying bitmaps (more efficient than sixel), that I quite like together with ranger.