kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
23.72k stars 958 forks source link

clarify icat usage #6828

Closed gknittl closed 9 months ago

gknittl commented 9 months ago

Is your feature request related to a problem? Please describe. I'm using imagemagick to draw on images. This is in a kitty 0.31.0 tab with 2 windows. Kakoune is editing the imagemagick commands in one window. kitty +kitten icat displays the image with drawing in the other window. I execute a bash script from kakoune to run imagemagick and use kitty remote control icat to display the resulting image. This does work but in reviewing the docs the following is unclear to me:

1/ https://sw.kovidgoyal.net/kitty/remote-control/#kitten-kitten seems to suggest it would be possible to use --match with the generic "kitten" kitten to direct the icat output to the correct window. I can't get this to work. kitten --match id:12 icat work.jpg returns Error: Unknown option: --match

kitty @send-text does support --match. This works but it seems "clunky" to send the text of the icat command to the other window along with $'\n' to execute it as opposed to specifying --match directly on icat.

2/ imagemagick can output the modified image to stdout and icat is supposed to be able to read from stdin but I can't figure out how to get icat to read from stdin when using kitty @ send-text --match id:12 kitty +kitten icat work.jpg. Resolving 1/ above might make it easier to pipe imagemagick into icat.

Describe the solution you'd like clarify docs and/or add --match support to icat

Describe alternatives you've considered Worked around with send-text to get icat to the right kitty window and by using a regular image file to communicate between imagemagick and icat instead of a pipe

Additional context Kitty has so much function that there are bound to be either rough edges or more likely things I don't understand. I am very pleased with kitty. Kakoune integrates very nicely into kitty. I'm very grateful for your work.

kovidgoyal commented 9 months ago

Remote control and icat are entirely separate things.

kitten @ whatever is remote control

kitten icat whatever displays the image file whatever in the the current terminal window.

There is no such thing as remote icat. You need to run icat in whatever window you want to display the image is.

gknittl commented 9 months ago

Thanks so much. kitty @ send-text " imagemagick code | kitten icat" works fine. I.e. do the piping on the kitty command line instead of in the script. kitty @ send-text handles selecting the appropriate window just fine entirely separately from icat.

The ability to use kitty and kak together really cuts down the keystrokes required to draw on the images. It's better than gimp for me for this use case!

I'm still not understanding the doc entry for https://sw.kovidgoyal.net/kitty/remote-control/#kitten-kitten. Can it be used with icat? Would it be possible to provide an example?

kovidgoyal commented 9 months ago

No that is for kittens that are part of the kitty UI usually custom kittens. kittens in kitty refer to two types of things, standalone programs you run at the shell prompt such as icat and parts of kitty UI such as unicode_input. Running them via remote control refers to the latter not the former.