-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Chafa functionality inconsistent #1339
Comments
@Longoon12000 Is it a high/variable latency link? FWIW I think Neofetch expects to get a response from the client terminal emulator in less than one second. The timeout seems to be consistent with it working sometimes and sometimes not. I doubt this is a bug in Chafa. Does it work consistently with other image-to-text backends? |
High latency, no (15ms ping + whatever it takes for ssh to encrypt and decrypt), but variable, definitely. I also noticed that it's most prominent at the beginning of an ssh session with declining frequency.
I'm not sure how this works through SSH. Neofetch doesn't poll my actual terminal emulator where I'm running SSH on the client for the size but rather whatever bash is running on the server, right?
Chafa by itself works fine all the time but you're right that it's not only related to Chafa in neofetch:
According to the Images Backends documentation these are image-to-text backends:
The others (iTerm2, Sixel, Tycat, W3m) aren't image-to-text and wouldn't work over ssh anyways I think. So it's definitely not only Chafa related but a general issue on an SSH connection. I couldn't reproduce this issue on my local machine. As a workaround I have stored the chafa output in a text file and provided this to --ascii. This works fine (except I need a gap of -985 wth?) and I don't really need to re-generate the ascii image every time neofetch runs anyways. However this wouldn't solve this issue if someone would want to generate ascii from a dynamic image (except by always running chafa before neofetch). |
@Longoon12000 Sorry for getting back to this so late, I was traveling and then it fell off my radar.
That's exactly what happens -- it sends an escape code that's received by your terminal emulator, and it's supposed to send its window size back. Neofetch waits for up to a second (actually .05 seconds on modern bash) for the round trip to happen, and if the response doesn't arrive within that interval, it will assume the escape code is unsupported. See this line in Neofetch master. Change the TBF I think Neofetch wrongly rules out Chafa and other character cell-based image backends if it fails to get the window pixel size. It could guess at the character cell size instead (1:2 aspect ratio is the default fallback in Chafa and it's usually not too far off). |
See: #1392 |
@dylanaraps Would you accept a PR to increase the bash timeouts here: Line 4241 in b3e21d8
The issue is that it needs a little more time if you're running neofetch on a remote host. 5 seconds would probably cover most cases, and it shouldn't add any delay for most users as the timeout only comes into play if there is no response from the terminal. |
Remote or just generally slow sessions could have too high latency for the terminal response to get through before the timeout, rendering in-terminal image backends unusable. Increase the timeout to accommodate these. See dylanaraps#1339.
Description
Running neofetch through an SSH connection using chafa sometimes causes "Image: Failed to find terminal window size.". I can run the command ten times in a row and maybe two times it wouldn't work. When it fails it would do a bell sound (\a) and also leave the string "1350;630t" in the next bash line.
In the 6.0.0 screenshot you can see that it worked and then it suddenly didn't, just by running the exact same command.
I tried the latest release 6.1.0 to see if it was maybe fixed but couldn't get chafa to work at all, with the same error message but no bell or additional string in the next line. Not sure if that's related.
Neofetch version
6.0.0
Screenshot
6.0.0 https://i.imgur.com/d5KYEX9.png
6.1.0 https://i.imgur.com/sHTB0vI.png
Config file
https://pastebin.com/cccuXC8T
Verbose log
6.0.0 https://pastebin.com/knYNHqQn
6.1.0 https://pastebin.com/uk4hPpQJ
The text was updated successfully, but these errors were encountered: