alpha-nvim icon indicating copy to clipboard operation
alpha-nvim copied to clipboard

feature request: image support

Open shaunsingh opened this issue 3 years ago • 29 comments

Hi, would it be possible to implement image support? https://github.com/edluffy/hologram.nvim can help with displaying the images

shaunsingh avatar Sep 10 '21 03:09 shaunsingh

jeez, so many kitty features simultaneously impress me and turn me off of kitty.

you should be able to whipup a rather hacky solution with the current set of features. the ui building api should already be extendable, but since hologram.nvim seemingly doesn't have a way of returning how many rows and columns an image takes up calculating how much space to allocate seems like it would be difficult/impossible. i might try to figure something out if i have spare time

goolord avatar Sep 10 '21 04:09 goolord

Yeah, the previous dashboard plugin (dashboard.nvim) kindof has image support. You could use a floating window running a terminal in place of the dashboard text, and then use something like uzerbeg to display the images. It was really hacky and barely worked though

shaunsingh avatar Sep 16 '21 02:09 shaunsingh

using ueberzug ( for linux ) would be nice since it works on every terminal :D

siduck avatar Sep 16 '21 04:09 siduck

dashboard-nvim (which this plugin is not a successor to, btw!) presumably did the terminal previewer for exactly this reason. there are simply too many competing standards.

my approach to designing this api was such that functionality could be added by another plugin, i think i will write 1 such plugin and any further implementations can be contributed :)

goolord avatar Sep 16 '21 05:09 goolord

i can't seem to get hologram to work at all, let alone with alpha :/

goolord avatar Sep 26 '21 15:09 goolord

i can't seem to get hologram to work at all, let alone with alpha :/

try using ueberzug to display stuff ._.

siduck avatar Sep 26 '21 16:09 siduck

image

A lil script taking from telescope-media repo

siduck avatar Sep 26 '21 16:09 siduck

unfortunately ueberzug also doesn't seem to work for me i read that maybe it doesn't support wayland but since they have seemingly closed their issue tracker there's no way for me to know

goolord avatar Sep 29 '21 17:09 goolord

unfortunately ueberzug also doesn't seem to work for me i read that maybe it doesn't support wayland but since they have seemingly closed their issue tracker there's no way for me to know

which distro?

siduck avatar Sep 29 '21 17:09 siduck

according to the repo info section:

...display images in combination with X11 I'm assuming that means no wayland support

The only cross-platform ways I can think of are

  • kitty + kitty image stuff
  • sixel-compatible terminal + sixel image stuff

I think the best solution would be to create a successor to hologram.nvim, but sounds like quite a bit of work and would end up being extremely complicated if we were to support multiple image protocols.

The easiest (but hackiest) way is to just open a floating neovim terminal window and run uberzug/sixel/kitty-image. Since the dashboard doesn't scroll, maybe you/we could consider an option to replace the dashboard ASCII with a terminal instead, where the user could run anything?

shaunsingh avatar Sep 30 '21 20:09 shaunsingh

sixel and kitty stuff are very terminal specific , not all terminals support sixel graphics which is upsetting :(

siduck avatar Sep 30 '21 23:09 siduck

sixel and kitty stuff are very terminal specific , not all terminals support sixel graphics which is upsetting :(

there is not a good cross platform way of displaying images in a terminal. there are simply too many competing standards and none of them are very complete, which is why dashboard does the floating terminal window thing

goolord avatar Oct 01 '21 01:10 goolord

sixel and kitty stuff are very terminal specific , not all terminals support sixel graphics which is upsetting :(

there is not a good cross platform way of displaying images in a terminal. there are simply too many competing standards and none of them are very complete, which is why dashboard does the floating terminal window thing

yes , but ueberzug works on all terminals on linux ( but not wayland )

siduck avatar Oct 01 '21 01:10 siduck

honestly maybe chafa is the way to go? You don't get a proper image, its made up of unicode blocks. Benefit being that every single terminal will work, the drawback is a much lower resolution image

shaunsingh avatar Oct 01 '21 02:10 shaunsingh

this seems promising https://github.com/bytesnake/vim-graphical-preview

goolord avatar Apr 06 '22 04:04 goolord

this seems promising https://github.com/bytesnake/vim-graphical-preview

ig only a few terminals have sixel graphics support

siduck avatar Apr 06 '22 05:04 siduck

the upshot being that it actually works : )

goolord avatar Apr 06 '22 05:04 goolord

What about to steal dashboard code?

EpsilonKu avatar Aug 26 '22 17:08 EpsilonKu

it's already in alpha https://github.com/goolord/alpha-nvim/pull/124 @EpsilonKu

goolord avatar Aug 26 '22 17:08 goolord

No, I mean ready ueberzug script.

EpsilonKu avatar Aug 26 '22 17:08 EpsilonKu

does dashboard integreate ueberzug now?

goolord avatar Aug 26 '22 17:08 goolord

https://github.com/glepnir/dashboard-nvim/commit/0c3fb6e7a430859b8c1b605fa9fdcf38df0dc079 . Kinda yeah

EpsilonKu avatar Aug 26 '22 17:08 EpsilonKu

well, ueberzug doesn't work on my machine, so I have no way to test it. but if someone submits a PR I'll happily approve it. the terminal PR should be a good example of how to extend the alpha api.

goolord avatar Aug 26 '22 17:08 goolord

well, ueberzug doesn't work on my machine, so I have no way to test it. but if someone submits a PR I'll happily approve it. the terminal PR should be a good example of how to extend the alpha api.

how did you test it?

siduck avatar Aug 27 '22 00:08 siduck

How about use Chafa to convert an image into graphics formats or ANSI/Unicode character art? It can display in terminal. There are also some discussion about this in dashboard-nvim

image

OpenWaygate avatar Feb 05 '23 16:02 OpenWaygate

if that's what you want to do you can use the terminal element https://github.com/goolord/alpha-nvim/blob/main/doc/alpha.txt#L137-L159

goolord avatar Feb 05 '23 16:02 goolord

this program supports Kitty, Sixel, iTerm and Unicode blocks with truecolor/ansi256 support otherwise. that's pretty much all the terminal picture protocols: https://github.com/emsquid/pic not sure if it is helpful, but thought i would share it here anw

justchokingaround avatar Mar 02 '23 15:03 justchokingaround