tmux

Enable hyperlinks in tmux config file


I'm trying to use hyperlinks in my terminal, which is a funny wrapper for Tmux in Gnome Terminal.

If I manually run Tmux with -T hyperlinks then the feature works. But with the wrapper I don't have a way to set that command-line arg, and anyway I'd like my Tmux to just always have this feature enabled.

man tmux says

-T features   Set terminal features for the client.  This is a comma-separated list 
              of features.  See the terminal-features option.

[...]

       terminal-features[] string
               Set  terminal  features  for  terminal  types  read   from
               terminfo(5).   tmux  has a set of named terminal features.
               Each will apply appropriate changes to the terminfo(5) en‐
               try in use.

               tmux can detect features for a few common terminals;  this
               option can be used to easily tell tmux about features sup‐
               ported    by    terminals    it    cannot   detect.    The
               terminal-overrides option  allows  individual  terminfo(5)
               capabilities  to  be set instead, terminal-features is in‐
               tended for classes of functionality supported in  a  stan‐
               dard  way  but  not reported by terminfo(5).  Care must be
               taken to configure this only with  features  the  terminal
               actually supports.

               This  is an array option where each entry is a colon-sepa‐
               rated string made up of a terminal type  pattern  (matched
               using fnmatch(3)) followed by a list of terminal features.
               The available features are:

[...]
               hyperlinks
                       Supports OSC 8 hyperlinks.

If I add the hyperlinks feature to my terminal-features string using set -as terminal-features ",gnome*:hyperlinks" as inspired by the FAQ, nothing changes.

Is this because my terminal-features command is wrong, or is it because setting terminal-features is not enough to enable the feature? (It's confusing but it sounds like maybe -T is about enabling the feature in Tmux and terminal-features is about overriding detection of features in the "outer" terminal?)? Is there any other way to enable hyperlinks in the Tmux config?


Solution

  • set -as terminal-features ",*:hyperlinks" should work.

    In my original question I wrote set -as terminal-features ",gnome*:hyperlinks", I don't think that would work since it seems gnome-terminal doesn't put gnome in $TERM.

    For this to work you must fully restart tmux - tmux kill-server then tmux new seems to do it.