lxqt / qtermwidget

The terminal widget for QTerminal
https://lxqt.github.io
GNU General Public License v2.0
494 stars 252 forks source link

[Feature request] SIXEL Support #552

Open Vinfall opened 3 months ago

Vinfall commented 3 months ago

Is your feature request related to a problem? Please describe.

QTerminal seems to be missing SIXEL support.

I'm trying to use lsix, a Bash script using ImageMagick to show thumbnails in terminal using sixel graphics, and it throws a warning about missing libsixel support:

Error: Your terminal does not report having sixel graphics support.

Please use a sixel capable terminal, such as xterm -ti vt340, or
ask your terminal manufacturer to add sixel support.

You may test your terminal by viewing a single image, like so:

convert  foo.jpg  -geometry 800x480  sixel:-

If your terminal actually does support sixel, please file a bug
report at http://github.com/hackerb9/lsix/issues

Please mention device attribute codes: ^[[?1;2c

Manually running the suggested command convert foo.jpg -geometry 800x480 sixel:- only shows random ASCII characters. I've installed libsixel and libsixel-util from package manager (Void glibc, if that matters) and manually run img2sixel foo.jpg provided by libsixel have similar output, hence the issue.

Describe the solution you'd like

Support that if possible, lsix README mentions that Your Terminal must support Sixel graphics which may be useful for a preliminary judgement on this. It talks about xterm or standard libvte based terminals but I really have no clue what's the case of QTerminal.

Describe eventual alternatives you've considered

A wontfix tag is also appreciated if support is not possible. I just want to figure out the problem.

Context

A unofficial mirror of the original sixel is available at https://github.com/saitoha/sixel. A SIXEL encoder/decoder implementation derived from kmiya's sixel is available at https://github.com/saitoha/libsixel.

I have no idea it's related to qterminal or qtermwidget, and I apologize if I report this in the wrong place.

marcusbritanicus commented 3 months ago

SIXEL support needs to be provided by the underlying qtermwidget. I have not found any major guides as to how to addd sixel support.

@tsujan @stefonarch I am working on porting the latest konsole sources to pure Qt. If I understand correctly, Konsole has sixel support. If I succeed in the porting work (I'm at least a couple of months from any reasonable result), we can have sixel support.

PS: I think this issue can be to be moved to qtermwidget

tsujan commented 3 months ago

@marcusbritanicus I have no knowledge in this area. We'll rely on your work. Thanks!

Vinfall commented 3 months ago

I have not found any major guides as to how to addd sixel support.

I think so. I notice the libsixel repo I linked in context has lots of implementation and you may find those useful. Generally speaking (as I have no Qt experience), The low-level conversion API (and whole API definition), ite-sixel patch and contour (which is also written in Qt I guess) seem to be the most promising references.

If I understand correctly, Konsole has sixel support. If I succeed in the porting work (I'm at least a couple of months from any reasonable result), we can have sixel support.

Just tested as I already had KDE Connect and Okular along with a bunch of KDE dependencies, I can confirm Konsole supports sixel. I don't mind waiting so keep up the good work!

Edit: suggest sixel implementation references