jamestalmage / supports-hyperlinks

Detect whether a terminal emulator supports hyperlinks
MIT License
54 stars 13 forks source link

doesn't correctly detect support in kitty terminal #10

Open adrian-gierakowski opened 3 years ago

adrian-gierakowski commented 3 years ago

hyperlink support has been added to kitty in version 0.18.4

however hyperlink support can be toggled with a config flag and I'm not sure how this could be detected by your module I'll create an issues in kitty's repo and link back to here

connorjs commented 1 year ago

Following the guidance given in the Kitty repo question, I finally got a Node JS script working using the DCS query approach.

Edit: Put code in details element.

Edit 2: Deleted code from comment. Now see https://github.com/connorjs/query-terminal/blob/main/query-terminal.js


Note: Alternatively, this repo could have Kitty-specific logic similar (maybe) to iTerm’s logic. Within kitty, we have the direct command.

kitty +kitten query_terminal allow_hyperlinks
# allow_hyperlinks: yes

Third, we could just assume Kitty supports hyperlinks and not query the configuration. (a) Kitty enables hyperlinks by default and (b) IIUC, printing the hyperlink when the terminal emulator doesn’t support it still renders fine (the escape sequences just no-op, essentially).

It looks like iTerm, WezTerm, and VS Code do this.


So, what are the owner’s thoughts on supporting kitty given these three options?

  1. DCS query (XTGETTCAP)
  2. Kitty shell command
  3. Just say yes for kitty

In the end, I vote for (3) personally, but it was fun getting (1) to work. I will look to package that as a node module this week (time permitting) given I’ve done the work.