savioxavier / termlink

Clickable links in the terminal for Go
https://pkg.go.dev/github.com/savioxavier/termlink
MIT License
64 stars 2 forks source link

Support alacritty #7

Closed FalcoSuessgott closed 5 months ago

FalcoSuessgott commented 2 years ago

Hi Im about to use this library for a project of mine. I have tested in and discovered that alacritty is currently not supported. Alacritty supports an URL behaviour similar to other terminals:

echo -e '\e]8;;http://example.com\aThis is a link\e]8;;\a'

Possible to support this. So far I havent seen any Env var that alacritty sets that we can use to detect the users terminal. Maybe I will provide a PR if I have an Idea.

Btw, you aware of this list https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda?

savioxavier commented 2 years ago

Hey there, thanks for your interest in this repo!

This project was initially made super quick, and I didn't bother to add support for every hyperlink supported terminal in existence, so yeah, a lot of terminals are missing (for example, VSCode, which supports it in newer version)

Possible to support this. So far I havent seen any Env var that alacritty sets that we can use to detect the users terminal. Maybe I will provide a PR if I have an Idea.

Neither have I, PRs welcome

Since I didn't know what environment variables to test for, the supports hyperlink code was initially ported from zkat/supports-hyperlinks, which is a library written in Rust, and although I didn't know any Rust, it was pretty easy to change it to Go. There wasn't Alacritty there, so I couldn't add it.

I checked the JS supports-hyperlinks as well, and it looks like there isn't an environment variable to check whether the terminal is Alacritty either.

Btw, you aware of this list gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda?

Yup, I think I've checked it once, cool list though.

savioxavier commented 1 year ago

Hello there,

I decided to revisit this project and felt like termlink needed a full rewrite.

I apparently found out that there exists a TERM variable. On alacritty, its value is alacritty. I've (possibly) fixed this in #8 and released a version v2.0.0 v1.3.0 (Go doesn't allow pure semver?). Could you please update termlink and see if this works now?

I'll reopen it now and keep it so, until it is fixed.

FalcoSuessgott commented 6 months ago

Just remembered this! I can verify that alacritty works to me now. Thanks to you, I can now redirect the output from vkv to the secret in Vaults UI! :)

savioxavier commented 6 months ago

No problem! I was glad to help!

FalcoSuessgott commented 6 months ago

Im so sorry I must have been tripping. I was testing within vscode not realizing it wasnt alacritty ... However, I got hyperlinks to work but only when overwriting the TERM env var to alacritty as defined in supportsHyperlinks(), but my current OS default is xterm-256, do you happen to know if that is default value when running alacritty? Im currently testing it

FalcoSuessgott commented 5 months ago

Alright, I have figured it out. termlink didn't work due to misconfiguration on my side. When following the Post Install Steps for Alacritty, the TERM var should be set to alacritty or alacritty-direct, mine was still on xterm-256 form on old dotfile configuration ...

Removing the obsolete dotfile setting and installing alacritty correctly, termlink lib now works correctly in vkv.

Thanks for your patience lol ..