LWN.net Logo

wlterm: the native Wayland terminal emulator

From:  David Herrmann <dh.herrmann-gM/Ye1E23mwN+BqQ9rBEUg-AT-public.gmane.org>
To:  Wayland <wayland-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW-AT-public.gmane.org>
Subject:  [ANNOUNCE] wlterm: Native Wayland Terminal Emulator
Date:  Thu, 27 Sep 2012 13:28:35 +0200
Message-ID:  <CANq1E4QUp7f0s3En1406dayCRjRZxxy=0e-mEHAaceNbxN0Mqg@mail.gmail.com>
Cc:  =?ISO-8859-1?Q?Kristian_H=F8gsberg?= <hoegsberg-Re5JQEeQqe8AvxtiuMwx3w-AT-public.gmane.org>
Archive-link:  Article, Thread

Hi

Last few days I have been working on "wlterm", a native terminal
emulator for wayland. You can find it here:
  http://github.com/dvdhrm/kmscon
Or check it out from:
  git://github.com/dvdhrm/kmscon.git

It shares the repository with "kmscon" currently. However, you can
build it independently with:
  ./autgen.sh --disable-kmscon --enable-wlterm && make
This will only build what is required for wlterm. The only required
dependency is libxkbcommon and libwayland-client/cursor! Everything
else is optional and will only be used when available during
./configure.

You can run it with:
  ./wlterm [--debug]

You can check out command-line options with:
  ./wlterm -h


You may wonder why wlterm is needed? There are several reason why I wrote it:

1) We need more independent clients written from scratch that try to
find bugs in the wayland-client API. If we use toytoolkit all the
time, we will probably not find them. wlterm draws its own decoration
and does not depend on any demo-code from the weston repository. So
its nice to check whether new weston features are working and how they
behave. The more independent implementations we have, the better
testing we get.

2) I use it to test the TSM library. TSM is a terminal-emulator state
machine that parses vt220/xterm control-sequences. It has no
dependencies at all and does not perform any rendering. It is solely
to parse and interpret CSI/OSC/etc. sequences. There is no such
library out there so I created TSM (which is already shared between
wlterm and kmscon). Other libraries like libvte have huge X, Gtk, Qt
etc. dependencies (sadly). And Kristian asked me whether it makes
sense to also share it with weston-terminal. Keep in mind that
weston-terminal does interpret only a small subset of xterm
escape-sequences and no-one really wants to maintain/develop a full
parser in weston-terminal (or is someone working on that?).

3) Get a proper and maintained emulator for weston. I intend to
maintain wlterm together with kmscon (but both will remain independent
from each other). So feel free to file bugreports, feature-requests or
happy-user-feedback. I am open to suggestions. But I am a horrible
designer so don't expect it to be fancy. I rather work on
functionality than on beautiful decorations. I will also keep the
"master" branch a "stable" branch so you can expect it to always work
and to contain no experimental features (no guarantee, though).

4) To get more insight into wayland protocol internals. As I am
working on man-pages for libwayland, I wrote the small fake-toolkit
from scratch to get a better feeling. I can recommend this to
everybody who wants to get more knowledge on how it works. And to
everybody who wants to contribute to the man-pages...

I don't know how I will continue this when the big toolkits get proper
wayland-support (with decorations) and the well-known
terminal-emulators work with weston. However, until then I try to
maintain it.
Thanks for the big help on IRC! (the resizing-bugs are fixed now)

Regards
David


(Log in to post comments)

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 15:30 UTC (Thu) by bkw1a (subscriber, #4101) [Link]

How does it do with "vttest"?:

http://invisible-island.net/vttest/

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 16:00 UTC (Thu) by dvdhrm (subscriber, #85474) [Link]

wlterm actually uses TSM as terminal-emulator. It emerged out of kmscon while I was looking for a terminal-emulator-library that is independent of any graphics-libraries and which does not render anything but only does vt-emulation. I didn't find one so I started TSM which is developed in-tree with kmscon and wlterm.

vt220 is almost fully supported and many extended feature are also available, but it doesn't pass all vttest tests. Things like double-width/height lines are still missing, but these are also rarely used today. Main focus was on making vim/emacs/mc/etc. work correctly (which currently do) and now we try to get full compliance to nearly all xterm features. But vttest is used heavily for testing.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 16:00 UTC (Thu) by Yorick (subscriber, #19241) [Link]

Isn't it time we stopped regarding vttest as the arbiter of terminal "emulator" correctness? It's in many ways an impressive and useful program, but its existence has caused much programming effort being wasted in the pursuit of a perfect vttest "score" — be it VT-52 mode, DEC line drawing characters, tab stop setting, double-wide characters, answerback messages, and other useless features. (I know, because I have been one of those programmers. I'm better now, thank you.)

Some of these "mandated" features are actually negative, as they make it too easy to get the terminal into a broken state, or can be outright security holes.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 16:42 UTC (Thu) by butlerm (subscriber, #13312) [Link]

Personally, I would be happy if in our advanced state of civilization, we could simply get reliable handling of the backspace key. That seems to be a problem in a lot of circumstances. SSH from cygwin, for example.

wlterm: the native Wayland terminal emulator

Posted Sep 29, 2012 7:07 UTC (Sat) by quanstro (guest, #77996) [Link]

i'd be happy if we stopped emulating terminals,
complete with baud rate and other anachronisms.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 16:22 UTC (Thu) by mpr22 (subscriber, #60784) [Link]

The second sentence of the first paragraph of the synopsis is sufficient to persuade me that even if vttest is a useful and effective program, it needs to be either replaced, or forked by someone who doesn't laud knowledge-hiding.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 19:28 UTC (Thu) by josh (subscriber, #17465) [Link]

That sentence doesn't strike me as endorsing knowledge hiding, so much as not wanting to maintain a duplicate (and likely outdated) description of the tested functionality beyond that embodied in the source code. A quick look at the xterm ctlseqs document will typically provide enough information to fix a vttest failure.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 19:43 UTC (Thu) by bkw1a (subscriber, #4101) [Link]

Thanks for pointing out the ctlseqs.txt document:

http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt

If I ever knew about it, I'd forgotten. I think it's interesting that all of the tektronix and vt52 stuff is only the last 6% or so of this long file.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 15:46 UTC (Thu) by nickbp (subscriber, #63605) [Link]

Here's hoping that the "wl" prefix isn't the new "x" prefix -- please get better names.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 17:07 UTC (Thu) by sjj (subscriber, #2020) [Link]

+1. One of my pet peeves is the "Look Ma, I'm using %s! And to show everybody how clever I am to use it, I named my thing with %s!" naming convention that plagues open source. K is the worst, py comes pretty close second. I guess X started it...

wl is particularly cumbersome to pronounce too. If you have to do this, how about "way-"?

Nice thing

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 17:08 UTC (Thu) by sjj (subscriber, #2020) [Link]

Oops, don't know what I was trying to say with "Nice thing "...

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 17:51 UTC (Thu) by leif81 (guest, #75132) [Link]

I aprove the 'way' prefix. I could get used to saying wayterm.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 20:46 UTC (Thu) by teknohog (guest, #70891) [Link]

> I could get used to saying wayterm.

waybackmachine (for backups)
waynesworld (nintendo emulator)

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 18:13 UTC (Thu) by rahvin (subscriber, #16953) [Link]

This is a HUGE pet peeve of mine. Apt-cache search X and you get a list so long you might as well google it. I appreciate the benefit that prefix provides under certain circumstances, but it's been abused so badly that finding the right package becomes a huge list that will have to be manually sorted when you can't recall the name of the package you are looking for.

I will also second the list of abusers, X, py, K, lib (yes I know lib is probably one we have to live with, but there is a package I can't recall with a name that has lib in it but it's not a library and it's impossible to find) and several others have made searching for anything with those characters an exercise in futility.

Naming conventions

Posted Sep 27, 2012 19:01 UTC (Thu) by dskoll (subscriber, #1630) [Link]

Hah! Try apt-cache searching for "R" (the math/statistics package)

(Debian calls it r-core, but you have to know that in order to know it.)

Naming conventions

Posted Sep 27, 2012 19:02 UTC (Thu) by dskoll (subscriber, #1630) [Link]

I even got it wrong. It's r-base :(

Naming conventions

Posted Sep 27, 2012 20:03 UTC (Thu) by sjj (subscriber, #2020) [Link]

apt-cache search --names-only '^r-' is a bit better but you have to know about the hyphen in package names.

Naming conventions

Posted Oct 3, 2012 18:45 UTC (Wed) by BenHutchings (subscriber, #37955) [Link]

'axi-cache search r' works a lot better.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 6:34 UTC (Fri) by mgedmin (subscriber, #34497) [Link]

> there is a package I can't recall with a name that has lib in it but it's not a library

libreoffice?

The binary names in it are also fun: I kept parsing 'localc' as 'local-c' and trying to understand what it was (a local C compiler?) before I understood it was actually 'l-o-calc'.

wlterm: the native Wayland terminal emulator

Posted Oct 1, 2012 9:34 UTC (Mon) by njd27 (subscriber, #5770) [Link]

librecad is another example.

wlterm: the native Wayland terminal emulator

Posted Sep 29, 2012 9:45 UTC (Sat) by marcH (subscriber, #57642) [Link]

How can you expect any single letter to be searchable?

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 20:22 UTC (Thu) by boudewijn (subscriber, #14185) [Link]

Well, my pet peeve is people whining about application naming. It's petty and small-minded.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 20:44 UTC (Thu) by andresfreund (subscriber, #69562) [Link]

Unless its names you cannot sensibly search the web for like 'perf'.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 11:07 UTC (Fri) by nix (subscriber, #2304) [Link]

Language names are much worse. Clojure is a nice searchable name. Haskell is OK on this front (though it's both a personal and family name so is somewhat ambiguous); Java is tolerable, but C? Go? Not much chance of finding *that*.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 11:15 UTC (Fri) by andresfreund (subscriber, #69562) [Link]

C has a pretty good excuse with being around before the web, universally available search engines and all but I still cannot grok what made the go designers choose that name.
Its as if the respective authors have desire of not being used/searched/found.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 12:28 UTC (Fri) by madscientist (subscriber, #16861) [Link]

You guys do know that you can use more than one word at a time with Google, right? I mean, you can type "programming language go" and ... amazing! ... first hit.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 20:33 UTC (Fri) by deepfire (subscriber, #26138) [Link]

Good luck with not missing the rare pages which are actually apropos to your needs this way..

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 13:41 UTC (Fri) by tzafrir (subscriber, #11501) [Link]

Not that long before the WEB. C was invented in 1972. In 1984 Knuth reported in an article about his Pascal program(PDF):
I chose the name WEB partly because it was one of the few three-letter words of English that hadn’t already been applied to computers.

wlterm: the native Wayland terminal emulator

Posted Sep 29, 2012 10:29 UTC (Sat) by nix (subscriber, #2304) [Link]

And he was right! At the time. If he could look twenty years forward I think he might perhaps have chosen another name, *any* other name. :)

wlterm: the native Wayland terminal emulator

Posted Oct 4, 2012 12:16 UTC (Thu) by juliank (subscriber, #45896) [Link]

Searching for golang usually works good enough.

wlterm: the native Wayland terminal emulator

Posted Oct 4, 2012 21:14 UTC (Thu) by jnareb (subscriber, #46500) [Link]

> Unless its names you cannot sensibly search the web for like 'perf'.

I agree that 'perf' subsystem is a stupidly unsearchable name... so try searching for 'perf events' instead.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 22:23 UTC (Thu) by sjj (subscriber, #2020) [Link]

Sure, I can see why you would defend names starting with K ;-) Don't take this the wrong way, I appreciate your input here on all things K and Krita. You've done much more for the community than I have. I even understand how we ended up here, but nowadays _to me_, the KDE start menu looks like it was designed by and for middle schoolers*. Application naming is part of a DE's user interface and kuteness becomes tiring after a while.

Like I said, it's a pet peeve, or "minor annoyance that an individual identifies as particularly annoying to them". So, not earth shattering importance. I consider "small-minded" more of an insult. But this is not the place or time for a flamefest. Peace out, bro!

* in the US, 11-13 year olds.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 13:56 UTC (Fri) by pboddie (subscriber, #50784) [Link]

the KDE start menu looks like it was designed by and for middle schoolers

The one that pretends to be an iPod or the old one that behaved like a normal menu? The former's behaviour is surely less tolerable than any potential renaming of the shutdown option as "Kthxbye".

wlterm: the native Wayland terminal emulator

Posted Sep 29, 2012 10:30 UTC (Sat) by nix (subscriber, #2304) [Link]

I actually find the new menu really useful, because it minimizes the number of mouse motions necessary to get to any given item, and minimizes the distance you need to travel. But it's definitely sufficiently unusual that it probably turns off quite a lot of people.

wlterm: the native Wayland terminal emulator

Posted Oct 1, 2012 12:22 UTC (Mon) by pboddie (subscriber, #50784) [Link]

Recent experience suggests that it's pretty difficult to explain to people how to use it (1) over the telephone and (2) from memory of how it actually behaves, especially when a normal menu would be obvious enough. There's also the issue of navigating through a keyhole when the door is already open, but I know that the other extreme is full-screen menus, and that menu navigation can also be an exercise in applying finely tuned motor skills.

I love the K thing

Posted Sep 28, 2012 23:11 UTC (Fri) by blackbelt_jones (guest, #62623) [Link]

I don't expect the name of an application to entertain me. I expect the name of an application to it tell me what it is, as succinctly as possible. I know it seems korny, but I think the k prefix is genius, because of its economy. It identifies an application as being part of KDE, often without making the application name longer, not by a single character. The KDE terminal emulator in konsole. Easy Peasy.

This is yet another thing I hate about Gnome. What's the name of the terminal emulator in gnome? "Gnome-terminal". There are a whole lot of other apps that begin with "gnome-", so if I'm trying to open the application with the run command dialogue, I have to type 7 characters before I have any hope of identification for successful completion.

I love the K thing

Posted Sep 30, 2012 7:17 UTC (Sun) by marcH (subscriber, #57642) [Link]

Single letter prefixes like 'k' also show some humility: these applications don't assume everyone is using KDE (or else)

I love the K thing

Posted Oct 1, 2012 14:14 UTC (Mon) by sorpigal (subscriber, #36106) [Link]

It's great, but tell me what part of KDE is kthreadd from? I don't use it and I wish to terminate this application.

But seriously, names mean what people want them to mean. A thing's names does not represent it's function, its function represents its name.

> There are a whole lot of other apps that begin with "gnome-", so if I'm trying to open the application with the run command dialogue, I have to type 7 characters before I have any hope of identification for successful completion.

But on the plus side, I can list all GNOME apps by typing gnome-[tab][tab], except for the ones that don't follow the convention. If it were applied universally the {gnome-,g,k} prefix would be much more useful, but it's inconsistent and you still have to guess.

I love the K thing

Posted Oct 2, 2012 10:22 UTC (Tue) by hummassa (subscriber, #307) [Link]

> great, but tell me what part of KDE is kthreadd from?

That's from the kernel, not kde...

http://www.linuxvox.com/2012/06/what-is-the-kthreadd-proc...

I love the K thing

Posted Oct 2, 2012 10:59 UTC (Tue) by mpr22 (subscriber, #60784) [Link]

It seems to me that sorpigal (a) is perfectly aware of this (b) is raising a valid point regarding the overloading of the single-letter prefix 'k'.

I love the K thing

Posted Oct 2, 2012 4:07 UTC (Tue) by tnoo (subscriber, #20427) [Link]

Like, for example, kthreadd, khelper, and many others? This occasionally would have bitten me when I was trying to get rid of all jobs related to KDE. The main distinction is the permissions needed to kill these jobs.

Now, who was first, KDE or Kernel?

I love the K thing

Posted Oct 2, 2012 4:11 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link]

Kill them all and the init sort 'em out!

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 19:59 UTC (Fri) by drag (subscriber, #31333) [Link]

Should name it 'weasel-term'. That would be awesome, completely memorable, and very google-friendly.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 20:16 UTC (Fri) by sjj (subscriber, #2020) [Link]

+1 :) Are you going to open a bug for Wayland to fix their naming convention? Might take some time to convince the devs.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 16:16 UTC (Thu) by endecotp (guest, #36428) [Link]

> TSM is a terminal-emulator state
> machine that parses vt220/xterm control-sequences.
> There is no such
> library out there so I created TSM
> Other libraries like libvte have huge X, Gtk, Qt
> etc. dependencies (sadly).

How hard did he look?

When I wanted a terminal-emulator state machine library for Anyterm, I quickly found ROTE. I later replaced it with something of my own (http://svn.chezphil.org/anyterm/trunk/src/Terminal.hh & .cc). Although it's often better to write your own rather than re-using (other peoples' code stinks!), it's good to be honest about how hard you looked!

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 16:49 UTC (Thu) by dvdhrm (subscriber, #85474) [Link]

The reasons ROTE wasn't used are:
ROTE does not support Unicode, does only cover like 1% of required escape-sequences, has not seen any update for like 5 years, does not support 256colors, does not support XKB input...

Same applies for VTERM which is based on it. And from my experience I can tell you that if Unicode support isn't planned right from the beginning, I wouldn't base my work on this.

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 17:58 UTC (Thu) by roblatham (subscriber, #1579) [Link]

mosh (http://mosh.mit.edu) prides itself on robust (including UTF-8) terminal support. Pitty they did not put their terminal-handling mojo into a library:

https://github.com/keithw/mosh/tree/master/src/terminal

wlterm: the native Wayland terminal emulator

Posted Sep 29, 2012 0:17 UTC (Sat) by lindi (subscriber, #53135) [Link]

It wasn't very robust when I tried it. Just typing

echo -en "\e[2147483647L"

caused it to spend a few minutes wasting CPU time and not responding to anything (CVE-2012-2385, has now been fixed).

wlterm: the native Wayland terminal emulator

Posted Sep 27, 2012 18:33 UTC (Thu) by cyanit (guest, #86671) [Link]

There is Putty's terminal code which is reused in IPBT, although IIRC the code quality kind of sucks (non-object oriented spaghetti C).

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 14:05 UTC (Fri) by Seegras (subscriber, #20463) [Link]

I switched to urxvt (rxvt-unicode-256color) after I switched to UTF8 (and wterm and aterm couldn't handle it). Right now, it's probably the best terminal in terms of features and compatibility.

And I can't absolutely imagine anything rewritten to only come near it within 5 years.

Try this: Use utf8; ssh to some host and start Midnight Commander, Do all characters and line-characters look right? Do all keyboard-shortcuts work? Does clicking with the mouse on menu-items work? If not, your terminal is trash and totally unuseable.
Start mutt, read your spamfolder, can you see russian and chinese characters in the spam or are there garbled characters? If garbled, either your terminal is broken or misconfigured.
Now, try w3m (w3m-img) locally. Where are the images displayed? If they're not inline, you've still got some work to do.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 15:12 UTC (Fri) by martinfick (subscriber, #4455) [Link]

I'd rather my SPAM stay garbled.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 19:08 UTC (Fri) by mathstuf (subscriber, #69389) [Link]

> Now, try w3m (w3m-img) locally.

How did I not know about this before? /me searches for webkit-based terminal browser.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 22:17 UTC (Fri) by drag (subscriber, #31333) [Link]

It works very well when combined as a pager for things like mutt. I know lots of people take a hardcore stance on html email, but it is (and has been) a valid internet standard for a very long time and a lot of people use it. So w3m is nice for this.

wlterm: the native Wayland terminal emulator

Posted Oct 1, 2012 9:17 UTC (Mon) by niner (subscriber, #26151) [Link]

Tried your tests on konsole out of curiousity and can report that at least version 4.9.1 passed all your tests without problems.

wlterm: the native Wayland terminal emulator

Posted Oct 4, 2012 12:21 UTC (Thu) by juliank (subscriber, #45896) [Link]

I can't even see Chinese characters in my browser... Just boxes, maybe with numbers in them.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 6:41 UTC (Fri) by cmccabe (guest, #60281) [Link]

There's a terminal emulator? Great, now Wayland has all the functionality I'll ever need ;)

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 12:10 UTC (Fri) by farnz (guest, #17727) [Link]

Better than that - there are two terminal emulators. This one, and the one that's shipped with Weston as a demo application.

wlterm: the native Wayland terminal emulator

Posted Sep 28, 2012 11:54 UTC (Fri) by mariuz (guest, #24892) [Link]

Now i should look for a stable wayland ppa

or i will recompile it over the weekend

http://wayland.freedesktop.org/building.html

wlterm: the native Wayland terminal emulator

Posted Sep 29, 2012 10:13 UTC (Sat) by marcH (subscriber, #57642) [Link]

In 2012, does software highly specific to recent versions of Linux still need to depend on the autotools nightmare?

(BTW you could just start autgen.sh with 'set -e')

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds