holzschu / a-shell

A terminal for iOS, with multiple windows
BSD 3-Clause "New" or "Revised" License
2.49k stars 112 forks source link

Displaying inline images #776

Open uwe-schwarz opened 1 month ago

uwe-schwarz commented 1 month ago

I'm trying to display an inline image from a file via this script: https://iterm2.com/utilities/imgcat. It looks like it's doing something, because it displays the following:

Inline Images | block | allow this session | always allow

This should be some kind of dialog box, but it's only text. IIRC is ish based on the same emulator and there I get the dialog box and can click on allow, after that it's working the next time.

Displaying the image uses this esc-sequence: printf "\033]1337;File=inline=%s" "$2"

holzschu commented 1 month ago

Hi, thank you for opening this issue. I was almost certain it was impossible, so I did not look into it until you asked. There were multiple issues with imgcat. Some of them were due to it using a syntax that is specific to bash, while we only have dash. Others were related to a-Shell having issues when dash stores a long output into a variable (as in out = $(base64 imageFile)). I couldn't make everything work, but imgcat will be available as a downloadable command (pkg install imgcat).

You will need to wait until the next release because I also had to disable the test that displays: Inline Images | block | allow this session | always allow.

holzschu commented 1 month ago

Hi, the TestFlight version ( https://testflight.apple.com/join/REdHww5C ) is now out, and it should work. You'll have to install the imgcat command with pkg install imgcat. The command is not exactly the same as the one from iTerm2 (I mostly disabled functions that check the validity of the arguments).

uwe-schwarz commented 1 month ago

Works like a charm. Thanks!