NikitaIvanovV / ctpv

Image previews for lf file manager
https://www.nikitaivanov.com/man1/ctpv
MIT License
264 stars 23 forks source link

"Error: Failed to open controlling terminal with error: input/output error" on kitty terminal #53

Open sr-prog opened 1 year ago

sr-prog commented 1 year ago

image

This error appears when I launch lf while using ctpv, I'm currently using kitty 0.28.1 and I think this error comes on versions that are higher than kitty 0.26.5 but I'm not 100% sure about it. Also I'm using icat for previews not ueberzug. Also image preview works completely fine but this error message coming up every time I launch lf is annoying and I'm not sure what's causing it to appear. Also I have tested and this error is there when I load kitty without any custom config.

tionis commented 1 year ago

I'm seeing a similar error in Kitty when using ctpv in a fzf preview command (with a wrapper that starts and stops the daemon in the background and sets the sizes)

sr-prog commented 1 year ago

So I figured out what was wrong, it's because of this command: image

I saw the readme and it looks like maybe this command is deprecated or something in favor of a ctpvquit command so I just replaced this in my lfrc

set previewer ctpv
set cleaner ctpvclear
&ctpv -s $id
cmd on-quit $ctpv -e $id

with this:

set previewer ctpv
set cleaner ctpvclear
&ctpv -s $id
&ctpvquit $id

TLDR; replace ctpv -e with ctpvquit I guess

If this fix doesn't work for anyone else who sees this I can re-open the issue on your request.

tionis commented 1 year ago

I'm still experiencing this error when used in fzf previews, but that may as well be a problem with fzf itself

NikitaIvanovV commented 1 year ago

ctpvquit is a wrapper around ctpv -e which just checks an lf process is running and if it's not, it kills the background process. I added it because cmd on-quit is a pretty new addition to lf and a lot of people don't have it. Maybe you also have an old version of lf, which caused the issue?

NikitaIvanovV commented 1 year ago

I'm still experiencing this error when used in fzf previews, but that may as well be a problem with fzf itself

Does it happen in terminals other than kitty? How did you integrate ctpv into fzf?

tionis commented 1 year ago

The issue only happens in kitty. I just used the fzfp script in the stpv repo and replaced the calls to stpv with appropiate calls to ctpv