[Feature request]Add the ability to remove individual images.
Sem1Rose opened this issue · comments
The --clear
option clears the entire terminal window, but i want to keep the terminal contents and only remove a specific image, similar to Ueberzugpp's identifier
option.
OS: Arch linux
Terminal: kitty
Thanks for filing the issue. This wouldn't be too hard to do, since we already support identifiers at the API level. However, it would only work with the Kitty protocol. The command line could look something like this:
Show image(s): chafa -f kitty --image-id 5
(shown images would be assigned IDs in ascending order starting at 5).
Remove image: chafa -f kitty --image-id 5 --remove-image
Would this do what you want, or are you using --clear
with multiple images (e.g. a slideshow) and need it to remove the image before showing the next, instead of clearing everything?
Thanks for the reply,
I think what I'm trying to achieve isn't about clearing the images, it's more about "don't display that specific image anymore." So for example, i have a bunch of images, each with its own description. Now, what i want to achieve is that for one of these images to just "cease to exist" without affecting the other images or their descriptions.
I'm not really home atm to test these commands, but as soon as im back I'll give them a go, hopefully this'll be exactly what I'm trying to achieve.
Ah, the options don't exist yet, it's just my suggestion for how we could implement this. Based on your description of the issue, it sounds like what you need.
Are you calling chafa from another program?
the options don't exist yet
Bummer, i hope you have time to implement it soon, fingers crossed it doesn't take too much time.
Are you calling chafa from another program?
yeah, i am, it's a rust program i've been working on for a while now. In a nutshell, i'm not directly using chafa to display images in the terminal, since this would take too much time. Instead, i'm caching the output of chafa for each image, and then to display the image i just print the cached output to the terminal, which takes significantly less time than just directly using chafa.
Edit: Actually, now that i think about it, will this method work with the --remove-image
option? i'm not really sure, i think it depends on the implementation.
I think it could work, but only with the Kitty protocol. Chafa also supports symbol mosaics, sixels and iTerm, and it wouldn't work with those.