Open RioNight opened 7 months ago
For what it's worth, there is a similar but different problem on Wezterm.
chafa -f sixel image.png
will produce no output.
However, cat
-ing the sixel text file also does not work, whereas it works in mintty.
chafa -f iterm image.png
works, but produces a image in a strange ratio:
This ratio is different than when I cat
the iterm text file in mintty as aforementioned.
Great testing! It's especially useful to know that it works with file redirection and not when printed directly to the terminal. We're using WriteConsoleA() on Windows in order to make it work in PowerShell etc. - and it behaves differently when redirected to a file.
We want to use the native runtime, so building with Cygwin is not an option. But we may be able to find a different workaround.
From my understanding of the mintty
issue, any native Windows app will be limited by the Windows pty, which will consume the special characters needed to display sixel graphics.
That is why you might need cygwin tools at every point to display sixel on Windows. This includes the terminal and the shell.
For example, I used mintty
and the cat
program from bash
(not from pwsh
) to output to the terminal.
Wezterm + bash
+ cat
will not work to display these files, which I believe is because Wezterm in not built with cygwin, even though sixel is supposed to supported in Wezterm.
Mintty + pwsh
+ bash
's cat
will also not work.
A few notes for completion:
~/.wezterm.lua
config file, set config.default_prog = { 'c:\\users\\USERNAME\\scoop\\apps\\git\\current\\bin\\bash.exe -i -l' }
. This is if you installed git with scoop. If you installed it with the default installer you will need to set it to something like this: config.default_prog = { 'c:\\Program Files\\Git\\bin\\bash.exe -i -l' }
.config.default_prog = { 'pwsh' }
to use pwsh in Wezterm.bash
's cat
in pwsh, you need to add the /usr/bin
in the git install folder to the Windows Path. Depending on how you installed git you would add something like C:\Users\USERNAME\scoop\apps\git\current\usr\bin
to the PATH. cat
may still get called from pwsh
, so you need to call bash's cat as cat.exe
.pwsh
in mintty, I just entered pwsh
into the bash prompt.It's one of the many issues waiting upon https://github.com/microsoft/terminal/issues/1173.
There's nothing chafa can do about it than have a cygwin build. I'll suggest it should be separate from the native windows build, not replace it... i.e treating cygwin as a separate platform.
As for wezterm... unfortunately, I don't think it has cywgin support. So, the only way graphics protocols can work is probably via WSL.
Just wondering, what is the native chafa build used for on Windows, or, what is the drawback of having the defacto Windows build be built by cygwin?
I think Wezterm and mintty (Git Bash) are the two main terminals that can display terminal graphics on Windows. Sixel won't work on Windows Wezterm because of conpty, so you're left with iterm on Wezterm and mintty and sixel on mintty.
Just wondering, what is the native chafa build used for on Windows, or, what is the drawback of having the defacto Windows build be built by cygwin?
Interoperability issues, basically. It cuts both ways. In effect, I think @AnonymouX47 is correct. We should be treating Cygwin as an additional platform. This is doable, but every binary distribution I have to do myself adds to release overhead (with the result that I make fewer releases). So I'd be greatly appreciative if someone offered to maintain Cygwin builds.
What's the situation with MSYS2 like? I see they have a fork of Cygwin but also ship mingw-w64 packages, including Chafa. Does their Chafa work on their mintty?
I'm also curious if Chafa behaves correctly when wrapped in winpty.
This is doable, but every binary distribution I have to do myself adds to release overhead (with the result that I make fewer releases). So I'd be greatly appreciative if someone offered to maintain Cygwin builds.
True and understandable. I think a title change and a "help wanted" (or so) lablel would be good.
sixel image:
iterm image is "empty", just like in the native windows build:
My tests were run using the mintty terminal + shell that came with Cygwin.
Without -f sixel
, I get a messed up image:
gifs somewhat work. In sixels, they play sped-up, and I need to press ctrl-c to get back the shell prompt. In iterm, they do not work at all.
I was able to compile chafa with Cygwin straightforwardly. I think we can use msys2, though I'm not sure. There's also mingw.
I will document my steps here for someone else to reproduce.
Install https://www.cygwin.com/install.html Note: See https://www.cygwin.com/faq.html#faq.setup.what-packages. This FAQ and others say that there is no package manager. msys2 has a package manager. https://packages.msys2.org/queue
In the Cygwin installer, you will reach the Select Packages screen. You can re-run the installer to get to this page, so you don't need to select them now.
The packages you need can be found by running chafa's ./autogen.sh. This did not work at first becuase of unix / dos line ending issues. I ran dos2unix
on it to fix these. You might need to run it on all the files in the git repository.
./autogen.sh
will tell you the packages you need. Run the cygwin installer again and find them on the package select screen. These are some of the ones I selected (some of these are included on the README.md). For some reason, cygwin here does not show that I selected autoconf.
make / make install said that there was an optional lib avif dependency which I could not find in the cygwin packages. It also said that I had to run ldconfig, which I also could not find.
@hpjansson, it might be easy to set up msys builds. msys builds use a build thing similar to Arch.
https://www.msys2.org/dev/new-package/
I am not familiar with creating packages for Arch. Whoever made the chafa Arch package could look at it if it is straightforward.
I've tagged this with "help wanted" - but with the xz débâcle fresh in mind, I should point out that I won't host binaries built by anyone other than myself on the official site.
I might make an exception for someone who's built trust over time, but I'd want to meet personally to verify their identity and exchange keys.
In the meantime, Chafa is free software, so anyone can build binaries and host them on their own site - but I can't be responsible for them. Hope that makes sense!
100% in support!
This is the image:![image](https://github.com/hpjansson/chafa/assets/58403689/b2e3f17c-920b-48e5-b158-68cdd5f2cdee)
I am using the mintty terminal on Windows. I am using bash, which comes with Git for Windows. So, the
cat
program is from there, which is different than powershell'scat
.scoop install git
will install Git for Windows with a terminal called "Git Bash". This is the mintty terminal I am using. See https://mintty.github.io/.chafa -f sixel image.png
produces no output:This is the sixel text file produced by
chafa -f sixel image.png > image.six.txt
: image.six.txtcat
-ing this text file displays this image, however:chafa -f iterm image.png
produces a large blank screen:This is the iterm text file produced by
chafa -f sixel image.png > image.iterm.txt
: image.iterm.txtcat
-ing this text file also works.The
./showimg
script in the mintty utils work as expected and display the image correctly with iterm. https://github.com/mintty/utilsAccording to this, https://github.com/mintty/mintty/issues/1252#issuecomment-1879848903 and the other comments in that issue, it seems like it could be solved if chafa is complied with cygwin.