After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 709942 - Allow for opening URLs displayed in the terminal without using the mouse
Allow for opening URLs displayed in the terminal without using the mouse
Status: RESOLVED OBSOLETE
Product: gnome-terminal
Classification: Core
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-10-11 21:25 UTC by Maxime Petazzoni
Modified: 2021-06-10 20:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Implementing patch (5.92 KB, patch)
2013-10-11 21:26 UTC, Maxime Petazzoni
none Details | Review

Description Maxime Petazzoni 2013-10-11 21:25:36 UTC
Currently, gnome-terminal uses a VTE match to look for URLs and other clickable links, which you can then open either by <Ctrl>+clicking them or by right-click + Open Link. But both require to use the mouse.

This patch, tested on both master and v3.8.4, offers an alternative. It provides a new feature to search for URLs that are in the currently visible region of the VTE buffer, and pops up a menu with one entry per URL that, when activated, opens the corresponding link in the browser. This feature is mapped to the <Ctrl>+<Shift>+U keybinding. This allows for opening any link that the user "sees" in the terminal without having his/her hands leave the keyboard.

The popup menu is positioned at the center of the terminal window to avoid loosing the focus after activating a menu item (in sloppy-focus window managers), and each entry in the menu is nicely formatted like so:

  <b>Domain.tld</b>
  <span size="small">http://the-full.url.com/path</span>

Hopefully I've covered all the bases for references cleanup, etc, but I'd appreciate a double check, especially with regard to 'match', which I add as a data property to each menu item and I'm not sure if those get freed by gtk_widget_destroy() or not.
Comment 1 Maxime Petazzoni 2013-10-11 21:26:03 UTC
Created attachment 257059 [details] [review]
Implementing patch
Comment 2 Maxime Petazzoni 2013-10-11 21:27:25 UTC
I would have liked to be able to re-use the already compiled (and probably more accurate) regex that matches URLs from terminal-screen.c (in url_regexes[0]), but I wasn't sure how to cleanly export those to terminal-window.c without extensive changes to header files, etc.
Comment 3 Christian Persch 2013-11-18 21:06:07 UTC
I don't think getting all the text from vte, then running the matchers on it, is the right way. Instead, vte should have API for getting all the (visible) matches.
Comment 4 GNOME Infrastructure Team 2021-06-10 20:35:23 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-terminal/-/issues/7374.