gokcehan / lf

Terminal file manager
MIT License
7.69k stars 326 forks source link

wezterm image preview #1230

Closed moisestohias closed 3 months ago

moisestohias commented 1 year ago

Wezterm is the only terminal that support image preveiwing in Windows. But lf dones't have proper config for wezterm imgcat. please add propper config support I tried invoking "wezterm imgcat" from external script but didn't work.

This seems to be an issue with the lf not wezterm

gokcehan commented 1 year ago

@moisestohias There are some instructions in the Previews wiki page for wezterm though I'm not sure if it works or not.

moisestohias commented 1 year ago

@gokcehan No unfortunately it doesn't work, and this seems to be an issue with lf not wezterm. I hope you took a look at the thread I've linked above, even with "tput cup" image preview still doesn't work. Wezterm is the only terminal that support image preview on windows and doesn't suck. So please fix this. I am like most people I guess trying to have consistent workflow when switching between linux and windows.

lkhphuc commented 1 year ago

FWIW, I followed the instruction for kitty on Wiki guide and it works fine on wezterm on Mac for me.

ryanmsnyder commented 1 year ago

@lkhphuc do you mind sharing your lf cleanup and preview scripts? I would appreciate it

moisestohias commented 1 year ago

@lkhphuc we are talking about wezterm not kitty here, I know it works fine in kitty

lkhphuc commented 1 year ago

@lkhphuc do you mind sharing your lf cleanup and preview scripts? I would appreciate it

@ryanmsnyder it's literally the script down below, calling the kitty +kitten

#!/usr/bin/env bash

kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty

I am running this kitten command on wezterm, because it has support for kitty image protocol. I'm not sure if that requires the install of kitty on your system or not, or if it works on Linux or not. It just that my system has wezterm and kitty installed, I can execute the command kitty +kitten in wezterm and the instruction for kitty in the wiki work fine for wezterm.

Screenshot 2023-07-15 at 16 26 21
ryanmsnyder commented 1 year ago

@lkhphuc thanks for confirming - that's what I assumed. I wonder if there's a native way to utilize the kitty image protocol within wezterm (without installing kitty)? Similar to how wezterm has the subcommand wezterm imgcat but that can handle coordinates like the kitty +kitten icat command.

@moisestohias, did you get wezterm imgcat working with lf? The command works for me when I pass it an image outside of lf but I'm wondering if the reason it doesn't work in lf as a previewer is because it can't take coordinates like the kitty +kitten icat command or ueberzug does. Looks like it can only take width and height:

image
ryanmsnyder commented 1 year ago

Just found this discussion on wezterm's GH discussing the same thing. And here's a feature request to enhance the wezterm imgcat command to accept a position flag as well as a clear flag when navigating away from the file. Go give it an upvote.