I'm trying to set up image previewing in vifm on Wayland with kitty on Arch Linux. However, when I try to preview an image, I get the error:
Error: Failed to open controlling terminal with error: open /dev/tty: no such device or address
vifmrc:
fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm,*.webp
\ kitty +kitten icat --transfer-mode=file --place=%pwx%ph@%pxx%py %c
\ %pc
\ kitty +kitten icat --transfer-mode=file --place=%pwx%ph@%pxx%py --clear
I've already tried googling (and chatgpt and phind ofc) the error message, but I couldn't find a solution that worked for me. Can anyone suggest a fix for this error?
Thanks in advance for your help!
The answer to your question is in this GitHub issue: kitty v0.27+ won't work Vifm v0.12.1. The :fileviewer
command in the question also lacks %N
which is necessary since Vifm v0.12 and here is its version for kitty v0.27+:
fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm,*.webp
\ kitten icat --silent --transfer-mode=file --place=%pwx%ph@%pxx%py %c >/dev/tty </dev/tty %N
\ %pc
\ kitten icat --clear --silent >/dev/tty </dev/tty %N
Why >/dev/tty
? Because despite requiring the terminal to be present it doesn't write to it anymore, kitty v0.27 writes to stdout.
Why </dev/tty
? Otherwise kitty v0.27 refuses to process --place
because it suddently thinks that you passed in 2 files if stdin isn't connected to /dev/tty
.
History of the question:
%N
macro to work around this and the issue was resolved for a while.%N
in Vifm created a new one for the preview command.%N
to keep Vifm's process group.You'll have wait for Vifm v0.13 to be available in Arch Linux or build Vifm yourself.