blog · git · desktop · images · contact

Explicit hyperlinks and context information for your terminal


In 2017, this Gist made some fuzz:

It’s about a draft-ish new escape sequence, which is supported by VTE. This new sequence makes it possible to use “explicit hyperlinks” in your terminal:

echo -e '\e]8;;\aThis is a link\e]8;;\a'

It looks like this:


Put simply, it’s supposed to have the same semantics as an HTML hyperlink.

It’s called “explicit”, because there is an explicit link target. Traditionally, you could only print some text and then hope for a terminal to recognize it as a URL:


All of this is very new and not a lot of terminal emulators support it, let alone applications running in the terminal or even ncurses. And even when your terminal uses VTE behind the scenes, the terminal application (meaning: LilyTerm, RoxTerm, Sakura, …) still needs new code, because VTE simply doesn’t know what is supposed to happen when a user clicks on an explicit hyperlink. Do you want a popup menu, do you want to launch a browser, … ? VTE just provides some signals and functions, which are to be used by the application.

I added support for it to xiate in late 2017, so at least I can play with this feature. :-)

One of the big questions is: What do you do with those links? When you click on them, what happens? I dodged this question in xiate and simply let users decide this – when you activate a link in xiate (be it an explicit one or a plain-text link matched by a regular expression), an external user-supplied program xiate-link-handler will be called. You can then do whatever you want in that program.

And another classic issue of “hyperlinks”: Where does a link point to? You will want to know that before activating it. This is why the next release of xiate will show a tooltip when your mouse hovers over a link. (Turns out, GNOME Terminal also does this.)


(That default GTK+ theme is a bit unfortunate and almost black on black.)

Now … Let that sink in. It is now possible to display some text in your terminal and have arbitrary additional information associated with it. This is not a new concept and has been possible in GUIs for ages, but not in terminals.

For example, I have this experimental mtr-based traceroute program, which can now show per-hop information in those tooltips:


To be honest, I find this even more interesting than the actual hyperlink functionality.