lanoxx / tilda

A Gtk based drop down terminal for Linux and Unix
GNU General Public License v2.0
1.28k stars 161 forks source link

Hyperlink support #285

Open egmontkob opened 7 years ago

egmontkob commented 7 years ago

VTE 0.49.1 (and GNOME Terminal 3.25.1) has just implemented a brand new and hopefully really cool feature: hyperlinks (that is, HTML-like anchors).

This is different from the regex-based autodetection of URLs that appear onscreen. This time the text that appears does not have to look like a URL, it can be anything, and the target URL is specified explicitly by the utility along with the displayed text, using a particular escape sequence.

In case you'd like to hook up to this new feature (I hope you do), here's what to do:

When handling file: URLs, please double check that you verify the hostname, as described in [1]. This is unfortunately not done by gtk_show_uri() or its underlying g_app_info_launch_default_for_uri().

In case a character cell belongs to both an explicit URL (this new feature) and an implicit autodetected one (the old one, using regex match), we recommend the explicit one to take precedence (we assume that the application emitting the URL knows it much better than the autodetecting regex). This is also how VTE underlines the cells, so this is what the user expects on e.g. a Ctrl+click. The right-click menu might display both entries, in GNOME Terminal we decided to display actions for the explicit hyperlink only in case of such collision.

Keep in mind that we're in a development cycle, there's a slim chance that the API will change before it's finalized in VTE 0.50 this September. I'll let you know here if it changes.

For further information on this feature, see

[1] A dedicated page with all the details: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

[2] The GNOME Terminal bugreport (way too long and probably not that interesting at this point): https://bugzilla.gnome.org/show_bug.cgi?id=779734