Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OSC 8 (hyperlinks) to make previews clickable #37

Open
christianparpart opened this issue Oct 15, 2020 · 11 comments
Open

Support OSC 8 (hyperlinks) to make previews clickable #37

christianparpart opened this issue Oct 15, 2020 · 11 comments

Comments

@christianparpart
Copy link

Hi,

I really like your little tool, and I'm surprised that a shell script is sufficient for that (with help of ImageMagick).

I'd like you to consider adding hyperlink (OSC 8) support so the generated previews are clickable. This would be a great addition, what do you think?

@hackerb9
Copy link
Owner

hackerb9 commented Oct 16, 2020

Thank you for the kind words.

That sounds like a potentially useful addition iff it can be done in a way that preserves the simplicity of lsix.

One problem is that the thumbnails are generated in blocks and they are not necessarily aligned with character cells. We would need a simple and efficient way to mark the character cells for each image. You wouldn't happen to have written code to do that yet, would you?

Also, I've read the official DEC documentation and Xterm's ctlseqs, but never run across OSC 8 before. Do you have a reference to where it is defined?

@christianparpart
Copy link
Author

Have a look here: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

Mind, the list on that document is not complete anymore, but it contains a very good specification.

Also, I just implemented sixel graphics basic support in my own terminal emulator and have been looking for client apps using that so I can test on it. So I found you, too. And cake up with the above idea.

@hackerb9
Copy link
Owner

hackerb9 commented Oct 18, 2020

It's a good idea. But it looks like it will add too much complexity to lsix. I'm hoping to keep that program minimalist so others can easily modify it.

I have another sixel project I'm working on, an image viewer, that is not released yet. Fitting the URLs into it would not be as hard as I aligned the images with the character cells. If you send me e-mail ([email protected]), then I can share with you the preliminary code so you can test your terminal emulator.

@hackerb9
Copy link
Owner

hackerb9 commented Oct 19, 2020

Have a look here: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

Mind, the list on that document is not complete anymore, but it contains a very good specification.

Also, I just implemented sixel graphics basic support in my own terminal emulator and have been looking for client apps using that so I can test on it. So I found you, too. And cake up with the above idea.

By the way, can you please send a link to your terminal emulator? I added the OSC 8 URL escape to the thumbnails in the sixel image viewer I mentioned, but I have no idea if it worked or not. The sixel terminal emulators I have tried (xterm & mlterm) don't support OSC 8 and the OSC 8 emulators (all VTE based) don't support sixel. Sounds like your program will fill a niche!

@christianparpart
Copy link
Author

By the way, can you please send a link to your terminal emulator? I added the OSC 8 URL escape to the thumbnails in the sixel image viewer I mentioned, but I have no idea if it worked or not. The sixel terminal emulators I have tried (xterm & mlterm) don't support OSC 8 and the OSC 8 emulators (all VTE based) don't support sixel. Sounds like your program will fill a niche!

Hey.

You can find it here: https://github.com/christianparpart/contour/

The sixel support is in the development branch named, wip. Please don't just git pull in the wip branch but git fetch && git reset --hard origin/wip when updating

I tested OSC-8 together with image support and it works in Contour. I will email you, too

@WSLUser
Copy link

WSLUser commented Jul 6, 2021

Here's the implementation from Windows Terminal: microsoft/terminal#7251 (there are follow-up PRs that improve the story of hyperlinks including adding File URIs as a acknowledged scheme (though with some limitations still in place).

@hackerb9
Copy link
Owner

Have a look here: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

Mind, the list on that document is not complete anymore, but it contains a very good specification.

Also, I just implemented sixel graphics basic support in my own terminal emulator and have been looking for client apps using that so I can test on it. So I found you, too. And cake up with the above idea.

And an excellent idea it is! 🥮

I'm sorry I lost track of this for nearly a year. I had meant to clean up my sixel image viewer code so it was presentable before publishing it, but I realized that I should just get it out there.

Here is vv, a very basic sixel image viewer that uses OSC 8.

The hand symbol shows up in Contour when I hover but nothing happens when I left or right click. Does Contour show the URL when hovering over a link? I'm not seeing anything. I'll have to reread the OSC 8 spec.

@christianparpart
Copy link
Author

christianparpart commented Sep 12, 2021

The hand symbol shows up in Contour when I hover but nothing happens when I left or right click.

Use Ctrl modifier with left click. That is also configurable in the input mappings.

Does Contour show the URL when hovering over a link? I'm not seeing anything.

No. But really good idea. Will add that.

@hackerb9
Copy link
Owner

Nice. It works now. Is it a known problem that Contour sometimes coredumps on sixels?

@christianparpart
Copy link
Author

Nice. It works now. Is it a known problem that Contour sometimes coredumps on sixels?

On sixels? That is new! But resize in alt screen and then leaving alt screen causing a SEGV is known. I am working on that. Maybe you can get me a stack trace of such thing as a new ticket ? :-)

@hackerb9
Copy link
Owner

@christianparpart Ticket sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants