kovidgoyal / kitty

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

trying to get image preview with fzf-tab autocompletion #6383

Closed codePassion-dot closed 1 year ago

codePassion-dot commented 1 year ago

Describe the bug I'm using fzf-tab to replace zsh default autocompletion and I'm trying to use +kitten icat for image preview this is what I have on my lessfilter file

mime=$(file -bL --mime-type "$1")
category=${mime%%/*}
kind=${mime##*/}
if [ -d "$1" ]; then
    exa --git -hl --color=always --icons "$1"
elif [ "$category" = image ]; then
  kitty +kitten icat "$1"
    exiftool "$1"
elif [ "$kind" = vnd.openxmlformats-officedocument.spreadsheetml.sheet ] || \
    [ "$kind" = vnd.ms-excel ]; then
    in2csv "$1" | xsv table | bat -ltsv --color=always
elif [ "$category" = text ]; then
    bat --color=always "$1"
else
    lesspipe.sh "$1" | bat --color=always
fi

but when I try to use it it stay loading forever so I was wondering if is something related with kitty (chafa works with other terminal emulators but not in kitty which is weird as chafa apparently use kitty image protocol) To Reproduce Steps to reproduce the behavior:

  1. install fzf-tab plugin oh my zsh
  2. add lessfilter config
  3. try
  4. See error

Screenshots If applicable, add screenshots to help explain your problem.

Environment details

kitty 0.28.1 (07bcc5ba61) created by Kovid Goyal
Linux pop-os 6.2.6-76060206-generic #202303130630~1685473338~22.04~995127e SMP PREEMPT_DYNAMIC Tue M x86_64
Pop!_OS 22.04 LTS pop-os /dev/tty

DISTRIB_ID=Pop
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Pop!_OS 22.04 LTS"
Running under: X11
Frozen: True
Paths:
  kitty: /home/jacobo/.local/stow/kitty.app/bin/kitty
  base dir: /home/jacobo/.local/stow/kitty.app/lib/kitty
  extensions dir: /home/jacobo/.local/stow/kitty.app/lib/kitty-extensions
  system shell: /bin/zsh
Loaded config files:
  /etc/xdg/kitty/kitty.conf
  /home/jacobo/.config/kitty/kitty.conf

Config options different from defaults:
allow_remote_control    yes
background_tint         0.6
clipboard_control       ('write-clipboard', 'write-primary')
confirm_os_window_close 0
font_family             DankMono Nerd Font Mono
font_size               24.0
hide_window_decorations 1
listen_on               unix:@mykitty
modify_font:
    cell_height 0
    cell_width 0
tab_title_template      {title}
url_prefixes            ('http', 'https', 'file', 'ftp')
Changed shortcuts:
    kitty_mod+e →  kitten hints
Colors:
    active_tab_background   #7aa2f7   
    active_tab_foreground   #1f2335   
    background              #1a1b26   
    color0                  #15161e   
    color1                  #f7768e   
    color10                 #9ece6a   
    color11                 #e0af68   
    color12                 #7aa2f7   
    color13                 #bb9af7   
    color14                 #7dcfff   
    color15                 #c0caf5   
    color16                 #ff9e64   
    color17                 #db4b4b   
    color2                  #9ece6a   
    color3                  #e0af68   
    color4                  #7aa2f7   
    color5                  #bb9af7   
    color6                  #7dcfff   
    color7                  #a9b1d6   
    color8                  #414868   
    color9                  #f7768e   
    cursor                  #c0caf5   
    foreground              #c0caf5   
    inactive_tab_background #292e42   
    inactive_tab_foreground #545c7e   
    selection_background    #33467c   
    selection_foreground    #c0caf5   
    url_color               #73daca   

Important environment variables seen by the kitty process:
    PATH                                /home/jacobo/.cargo/bin:/home/jacobo/.local/bin:/home/jacobo/.yarn/bin:/home/jacobo/.local/bin:/home/jacobo/.local/share/bob/nvim-bin:/home/jacobo/.config/rofi/bin:/home/jacobo/Android/Sdk/emulator:/home/jacobo/Android/Sdk/platform-tools:/home/jacobo/.fly/bin:/home/jacobo/.deno/bin:/usr/local/go/bin/bin:/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/cuda/bin:/home/jacobo/.local/share/JetBrains/Toolbox/scripts
    LANG                                en_US.UTF-8
    EDITOR                              nvim
    SHELL                               /bin/zsh
    DISPLAY                             :1
    USER                                jacobo
    XDG_SESSION_TYPE                    x11
    XDG_SESSION_CLASS                   user
    XDG_RUNTIME_DIR                     /run/user/1000
    XDG_MENU_PREFIX                     gnome-
    XDG_CURRENT_DESKTOP                 pop:GNOME
    XDG_SESSION_DESKTOP                 pop
    XDG_DATA_DIRS                       /usr/share/pop:/usr/share/gnome:/home/jacobo/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/
    XDG_CONFIG_DIRS                     /etc/xdg/xdg-pop:/etc/xdg

Additional context Try to reproduce the problem with kitty --config NONE if you cannot then post a minimal kitty.conf that reproduces the problem. If the problem involves interaction with some other terminal program post a minimal config for that program to reproduce the problem as well.

kovidgoyal commented 1 year ago

Sorry, I dont have the time/interest to debug fzf. Search its issue tracker you will find existing issues about image protocol support.

Most likely it runs the script without access to an actual terminal device or it interferes by doing I/O with the terminal while the script is running. As for chafa that will be because on other terminals its using block based drawing. Am sure it has an option to force that mode use it in kitty and it will work the same as in other terminals.