Skip to content

screen: add custom-url handlers for text-objects.

Rodolfo Granata requested to merge hyperlinks into master

Add functionality for matching text-objects on screen and being able to execute actions by clicking on them. Similar to functionality for http hyper-links.

Config for text-objects are loaded from $HOME/.gnome-terminal-customurls.rc

Changes:

  • add key-file config loading 'terminal_util_load_url_handlers'
  • compile 'Match' regex and hookup to vte terminal text matching
  • open custom formatted url on ctrl+click on the selected text-object

Config format:

  • Match=<regex for matching random text on the screen>
  • Rewrite=<printf-like format string where '%s' is replaced with the match>

Example for .gnome-terminal-customurls.rc:

[Diffs]
Match=D[0-9]{5,10}
Rewrite=https://jsfiddle.net/%s

[Pastes]
Match=P[0-9]{5,10}
Rewrite=https://my.urlrouter.org/?route=%s

Testing: With this config file in place try opening a terminal and type: $ echo D123456

Note how on mouse over you get the text-object underlined and can ctrl+click through it.

Merge request reports