-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add support for previewing images in room scrollback #108
Conversation
c9a0be7
to
aab4f0e
Compare
ffeda78
to
5e2ed67
Compare
really looking forward to this! |
It really only works with this patch on Alacritty, which seems to work because it simply never draws over image graphics. I'm working on fixing this in tui-rs-revival/ratatui in the linked PR, by setting some area to be "skipped". |
This will be great. I am using foot on wayland/sway should work. please release! 👍 |
5e2ed67
to
5ea2108
Compare
15fe152
to
f6c88e6
Compare
I was happy to see movement in this PR today, how is going? do you think if I patch this myself will it be somehow a bit stable? |
4cb4388
to
ed1a01a
Compare
@r3k2 I don't know what you mean by "patch". I can give you a status update though:
I am trying to fix the windows builds. |
d35d6e5
to
e22decd
Compare
@benjajaja cool, who cares about windows? :D :D just release it and say only works on Linux/Nix systems for now and that windows will come. |
e22decd
to
037bad6
Compare
736f3b0
to
d60625e
Compare
4e5170c
to
b3e97f8
Compare
can't wait for this, thanks @benjajaja for all your work ❤️ this will prob be the first CLI/TUI matrix client with sixel and other image previews, gomuks only shows a ascii representation, it will def bump to the top "iamb" in our TUI/low/simple resources/vim-keys/ community when it comes to matrix clients |
2edc335
to
ec22964
Compare
88a8ffe
to
2861155
Compare
2861155
to
e13e5bd
Compare
1874d0a
to
91b23de
Compare
Additionally to enable the preview feature, one must add it to config.json: ```json "image_preview": {} ``` See documentation for additional settings - they shouldn't be necessary in most cases. A feature flag for sixel support is added. Windows is basically unsupported, but it is possible to force the feature to use half-blocks, if the `protocol` option is set with `type` and `font_size`.
91b23de
to
d2cc428
Compare
I see all check passed and such, why we are not adding this already to the main IAMB? 🤔 |
Probably because it takes time to review complex contributions?
…On November 13, 2023 8:00:09 AM PST, ReK2 ***@***.***> wrote:
I see all check passed and such, why we are not adding this already to the main IAMB? :thinking:
|
As @craftyguy said, this is a big feature, and I like to make sure I understand and try out PRs locally before merging, so that I can document them correctly on the website and answer questions in I've been playing around with this locally and it's really cool! 🎉 This is amazing stuff @benjajaja ! Thank you for doing the I made a couple small changes in 164503b: I moved the picker setup code into I see that you just pushed the updates to use |
@benjajaja I've pushed some example docs to ulyssa/iamb.chat#18 . Let me know if you think that anything else should be mentioned there. |
@ulyssa There is nothing else I want to add for now. At some point later Thank you for moving the setup code! |
An image says more than a thousand words:
There has been some work to get some small change into ratatui that allows for "skipping" of rendering some cells (characters). This in turn allowed to make a crate ratatui-image that provides a image widgets for ratatui, taking care of the terminal's graphics protocol automatically. Currently the supported "protocols" are sixels, kitty, and unicode-halfblocks. iTerm2's protocol should be easy to add, I just don't have access to a mac.
This PR uses ratatui-image widget's
render()
method to render images in theScrollBack
widget, in the chat lines. This seems hacky, but this kind of usage was actually intended and recommended for these kind of use cases in the discussion on the ratatui PR.Currently, the download and image processing happens in one spawned tokio task per attachment. I also have a branch where only one "worker" is created, but I don't actually know if that is an actual improvement. I mainly made that branch/version to learn a bit more about tokio/tasks/threads in rust.