Hyperlinks in terminal emulators

gist.github.com

93 points by nvahalik a day ago


dust42 - a day ago

I really think this is a security disaster waiting to happen, landing right in time for all the agentic terminal apps:

  printf '\e]8;;http://evil.com\e\\https://good.com\e]8;;\e\\\n'
The next step would be to embedd a full javascript VM in the terminal and a CSS engine.
kalterdev - a day ago

So, the approach is identical to <a href="example.com">example</a>.

In contrast, in Plumber [1], we have things like !98—this text opens pull request no. 98 by passing "!98" to the local server, which knows how to interpret it.

Both approaches go one step beyond plain text. However, Plumber’s approach, at least, doesn’t compromise the plain text itself by embedding invisible elements.

This eliminates an entire category of risks by design. With no hidden metadata, accidental clicks are less probable and social engineering attacks, such as UI deception, are impossible.

[1]: https://p9f.org/sys/doc/plumb.html

spreadem - a day ago

The archived comments are an interesting read. Here is the snapshot just before the page owner removed them:

https://web.archive.org/web/20250324071822/https://gist.gith...

rrr_oh_man - a day ago

Yeah.. I was thinking of whether adding link parsing to itter [0], but decided against it. Somehow it didn't feel right.

[0] https://news.ycombinator.com/item?id=43936884

olejorgenb - a day ago

I think CLI code agents (eg. Claude Code) should render the line numbers in their diff view as links, opening that line in your editor of choice.

You can also make your own scheme-handler easily (on Linux at least). I have a `niri://` handler enabling linking to a specific Wayland window. (it has niche usecases :D)

This guy build a pty "proxy" to linkify Claude Code output: https://www.youtube.com/watch?v=GP5TwKnCzhQ

_flux - a day ago

I've found it nice to have the terminal emulator be able to match text with regexp and upon a click convert it to an external action. For example, I can click Python traceback in terminal and have Emacs go into that exact line in code, or the JIRA issue id and go to the web page.

I wonder though if this is a popular feature. Tilix is under minimal maintenance at the moment, so alternatives would be good to have..

diath - a day ago

I love these and wish they were used more by command line applications. For instance in GCC, when your terminal supports them, compiler diagnostic flags are clickable and something like "warning: address of local variable ‘a’ returned [-Wreturn-local-addr]" can be clicked to open the GCC documentation for that flag.

alpaca128 - 9 hours ago

> This feature doesn't introduce anything that's not already present while browsing the web. Therefore we believe this feature doesn't have security aspects to worry about.

Am I reading it wrong or is this seriously saying "this is secure because it's like web browsing"?

ladax72707 - 20 hours ago

> Mom, we can get Plumber[1]?

> We have Plumber at home.

> [Plumber at home]...

[1]: http://p9f.org/sys/doc/plumb.html

VorpalWay - a day ago

I have found this really useful together with file:// links. If properly set up, you can use this to go to a specific file, line and column in your IDE/editor even. Very useful with custom lint and debug tooling that I have written for my dayjob.

stuaxo - 8 hours ago

This is good and we need more of this sort of thing.

I don't want things to be silo'd just because I run them in the GUI Vs the terminal.

oldestofsports - a day ago

Browsers are great at hyperlinks, like really great. How about using browsers for hyperlinks instead?

tombert - a day ago

On my second day when I worked at Reddit, I learned by accident that I do not want my terminal to have clickable links.

I was working on image compression, and we had a script where we would render a column with the original image link, and a column with the new compressed image, and a column with the relative percentage of size to PNG, and there would be like 200 rows at a time.

I managed to somehow accidentally click on a link in iTerm, my browser opened, and I discovered what "sounding" [1] is, on a company computer, in the company office.

I saw it, whispered "oh fuck!", and quickly killed my browser. I don't think anyone saw me but I was extremely worried that I was going to get fired on my second day of work for viewing porn on a company computer in front of everyone, even though it was a legitimate accident.

So now I don't want my links to be clickable. If there's a link I'll highlight it and paste it into Firefox manually.

[1] If you do not know what sounding is, I do not recommend you look it up, just know that it's a weird sex thing that I wish I didn't know about and cannot unsee.

- a day ago
[deleted]
krautburglar - a day ago

This is barbarianism. This is Babel. Too many dunces trying to turn VT220 into Google Chrome. The long-term effect: the ruination of terminals. You can already see it. Try to run newer terminal apps on classic hardware terminals. Most of the time, you just get garbage, since nobody seems to bother to even check termcap anymore. They just directly shit out whatever bleeding-edge escapes that vte/iterm2/ghostty or other barbarianisms support as of the last five minutes.

If you want something half-way between VT220 and Google Chrome, please be original and make something new, rather than wiping your butt on a standard that is still somewhat functioning.

kristopolous - a day ago

tl;dr

here's coming from markdown

        LINK      = ["\033]8;;", "\033]8;;\033\\"]
        re.sub(r"\[([^\]]+)\]\(([^\)]+)\)", process_links, line)
        def process_links(match):
          description = match.group(1)
          url = match.group(2)
          return f'{LINK[0]}{url}\033\\{UNDERLINE[0]}{description}{UNDERLINE[1]}{LINK[1]}'