Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preview image fail, (sway+alacritty+tmux) #1899

Closed
2 of 3 tasks
ovwxxwvo opened this issue Nov 11, 2024 · 17 comments
Closed
2 of 3 tasks

preview image fail, (sway+alacritty+tmux) #1899

ovwxxwvo opened this issue Nov 11, 2024 · 17 comments
Labels
invalid This doesn't seem right

Comments

@ovwxxwvo
Copy link

What system are you running Yazi on?

Linux Wayland

What terminal are you running Yazi in?

alacritty+tmux

yazi --debug output

Yazi
    Version: 0.3.3 (c668723 2024-10-31)
    Debug  : true
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.3 (Arch Linux 2024-09-05)

Emulator
    Emulator.via_env: ("tmux-256color", "tmux")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect : Unknown([])

Adapter
    Adapter.matches: Wayland

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : None
    SWAYSOCK                   : Some("/run/user/1000/sway-ipc.1000.727.sock")
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL              : Some("/usr/bin/bash")
    EDITOR             : Some("nvim")
    VISUAL             : None
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None

Text Opener
    default     : Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block-create: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block-rename: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

Multiplexers
    TMUX               : true
    tmux version       : tmux 3.5a
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file             : 5.45
    ueberzugpp       : 2.9.6
    ffmpegthumbnailer: 2.2.3
    magick           : No such file or directory (os error 2)
    fzf              : 0.55.0
    fd               : 10.2.0
    rg               : 14.1.1
    chafa            : 1.14.2
    zoxide           : No such file or directory (os error 2)
    7z               : 17.05
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1


--------------------------------------------------
When reporting a bug, please also upload the `yazi.log` log file - only upload the most recent content by time.
You can find it in the "/home/oo/.local/state/yazi" directory.

Describe the bug

sometime work show a small pic, most of the time crash down or show nothing.
ueberzugpp is fine, something wrong with yazi.
if no in debug mode, show this in log "WARN yazi_adapter::emulator: [Adapter] No special environment variables detected"

Minimal reproducer

normal debug

Yazi
    Version: 0.3.3 (Arch Linux 2024-09-05)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.3 (Arch Linux 2024-09-05)

Emulator
    Emulator.via_env: ("tmux-256color", "tmux")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect : Unknown([])

Adapter
    Adapter.matches: Wayland

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : None
    SWAYSOCK                   : Some("/run/user/1000/sway-ipc.1000.727.sock")
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL              : Some("/usr/bin/bash")
    EDITOR             : Some("nvim")
    VISUAL             : None
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None

Text Opener
    default: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block  : Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

Multiplexers
    TMUX               : true
    tmux version       : tmux 3.5a
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file             : 5.45
    ueberzugpp       : 2.9.6
    ffmpegthumbnailer: 2.2.3
    magick           : No such file or directory (os error 2)
    fzf              : 0.55.0
    fd               : 10.2.0
    rg               : 14.1.1
    chafa            : 1.14.2
    zoxide           : No such file or directory (os error 2)
    7z               : 17.05
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1


--------------------------------------------------
When reporting a bug, please also upload the `yazi.log` log file - only upload the most recent content by time.
You can find it in the "/home/oo/.local/state/yazi" directory.

normal mode log

  2024-11-11T00:58:15.489680Z  WARN yazi_adapter::emulator: [Adapter] No special environment variables detected
    at yazi-adapter/src/emulator.rs:73

  2024-11-11T00:58:15.494144Z  WARN yazi_adapter::emulator: [Adapter] Unknown TERM_PROGRAM: tmux
    at yazi-adapter/src/emulator.rs:87

  2024-11-11T00:58:15.494152Z  WARN yazi_adapter::emulator: [Adapter] Unknown TERM: tmux-256color
    at yazi-adapter/src/emulator.rs:95

debug mode

Yazi
    Version: 0.3.3 (c668723 2024-10-31)
    Debug  : true
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.3 (Arch Linux 2024-09-05)

Emulator
    Emulator.via_env: ("tmux-256color", "tmux")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect : Unknown([])

Adapter
    Adapter.matches: Wayland

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : None
    SWAYSOCK                   : Some("/run/user/1000/sway-ipc.1000.727.sock")
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL              : Some("/usr/bin/bash")
    EDITOR             : Some("nvim")
    VISUAL             : None
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None

Text Opener
    default     : Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block-create: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block-rename: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

Multiplexers
    TMUX               : true
    tmux version       : tmux 3.5a
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file             : 5.45
    ueberzugpp       : 2.9.6
    ffmpegthumbnailer: 2.2.3
    magick           : No such file or directory (os error 2)
    fzf              : 0.55.0
    fd               : 10.2.0
    rg               : 14.1.1
    chafa            : 1.14.2
    zoxide           : No such file or directory (os error 2)
    7z               : 17.05
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1


--------------------------------------------------
When reporting a bug, please also upload the `yazi.log` log file - only upload the most recent content by time.
You can find it in the "/home/oo/.local/state/yazi" directory.

debug mode log

  2024-11-11T01:16:15.989387Z  WARN yazi_adapter::emulator: [Adapter] No special environment variables detected
    at yazi-adapter/src/emulator.rs:73

  2024-11-11T01:16:15.994180Z  WARN yazi_adapter::emulator: [Adapter] Unknown TERM_PROGRAM: tmux
    at yazi-adapter/src/emulator.rs:87

  2024-11-11T01:16:15.994187Z  WARN yazi_adapter::emulator: [Adapter] Unknown TERM: tmux-256color
    at yazi-adapter/src/emulator.rs:95

  �[2m2024-11-11T01:16:22.895687Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::emulator�[0m�[33m: �[33m[Adapter] No special environment variables detected�[0m
    �[2;3mat�[0m yazi-adapter/src/emulator.rs:75

  �[2m2024-11-11T01:16:22.898466Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::emulator�[0m�[33m: �[33m[Adapter] Unknown TERM_PROGRAM: tmux�[0m
    �[2;3mat�[0m yazi-adapter/src/emulator.rs:90

  �[2m2024-11-11T01:16:22.898485Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::emulator�[0m�[33m: �[33m[Adapter] Unknown TERM: tmux-256color�[0m
    �[2;3mat�[0m yazi-adapter/src/emulator.rs:99

  �[2m2024-11-11T01:16:26.804719Z�[0m �[34mDEBUG�[0m �[1;34myazi_adapter::ueberzug�[0m�[34m: �[34mueberzugpp rect before adjustment: Rect { x: 109, y: 1, width: 55, height: 13 }�[0m
    �[2;3mat�[0m yazi-adapter/src/ueberzug.rs:114

  �[2m2024-11-11T01:16:26.804810Z�[0m �[34mDEBUG�[0m �[1;34myazi_adapter::ueberzug�[0m�[34m: �[34mueberzugpp rect after adjustment: Rect { x: 109, y: 1, width: 55, height: 13 }�[0m
    �[2;3mat�[0m yazi-adapter/src/ueberzug.rs:116

  �[2m2024-11-11T01:16:26.804823Z�[0m �[34mDEBUG�[0m �[1;34myazi_adapter::ueberzug�[0m�[34m: �[34mueberzugpp command: {"action":"add","identifier":"yazi","x":109,"y":1,"max_width":55,"max_height":13,"path":"/tmp/yazi-1000/626280ccaf910bce055e01e0532a96c0"}
�[0m
    �[2;3mat�[0m yazi-adapter/src/ueberzug.rs:127

Anything else?

No response

Validations

  • I tried the latest nightly build, and the issue is still reproducible
  • I updated the debug information (yazi --debug) input box to the nightly that I tried
  • I can reproduce it after disabling all custom configs/plugins (mv ~/.config/yazi ~/.config/yazi-backup)
@ovwxxwvo ovwxxwvo added the bug Something isn't working label Nov 11, 2024
@sxyazi
Copy link
Owner

sxyazi commented Nov 11, 2024

This is an open issue with ueberzugpp, jstkdng/ueberzugpp#218

All Yazi does is just run ueberzugpp to display images, I don't think there's anything that can be fixed on Yazi side.

Closing as not Yazi and not doable

@sxyazi sxyazi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
@sxyazi sxyazi added invalid This doesn't seem right and removed bug Something isn't working labels Nov 11, 2024
@ovwxxwvo
Copy link
Author

This is an open issue with ueberzugpp, jstkdng/ueberzugpp#218

All Yazi does is just run ueberzugpp to display images, I don't think there's anything that can be fixed on Yazi side.

Closing as not Yazi and not doable

hey, again, I think yazi basic preview image plugin, got some problem.
ueberzugpp work fine in tmux, but yazi preview image crash down my whole terminal.

Uploading 20241111_144933.png…

@ovwxxwvo
Copy link
Author

This is an open issue with ueberzugpp, jstkdng/ueberzugpp#218

All Yazi does is just run ueberzugpp to display images, I don't think there's anything that can be fixed on Yazi side.

Closing as not Yazi and not doable

I done this shell script for joshuto preview image just few weeks ago, work fine.
Hope I can shift this script to yazi, but I didn't know yazi & lua better.
Help me a little bit, & get me some tips about the interface.
please... don't close me again, I can help ...

ueber_sever.sh

#!/usr/bin/env bash


# set var
  pane_tty=''
  pane_pid=''
  tail_pid=''
  ueber_pid=''
  ueber_dirt=''
  ueber_fifo=''
  # tv_ue_path_dirt='@ueberzug_path_dirt_'
  # tv_ue_path_fifo='@ueberzug_path_fifo_'
  # tv_jo_turn_ueber='@joshuto_turn_ueber_'

start_ueberzug() {
  # mk dirt & fifo
  pane_tty=$( tty |sed 's/\///g;s/dev//g' )
  # ueber_dirt='/tmp/ueberzug_XXXX'
  # [ ! -e $ueber_dirt ] && ueber_dirt=$(mktemp -d "$ueber_dirt")
  ueber_dirt='/tmp/ueberzug_'"$pane_tty"
  [ ! -e $ueber_dirt ] && mkdir "$ueber_dirt"
  ueber_fifo="$ueber_dirt"'/''ueberzug_fifo'
  [ ! -e $ueber_fifo ] && mkfifo "$ueber_fifo"
  echo $pane_tty $ueber_fifo
  echo
  echo 'mk dirt & fifo ...'
  echo
  # set tmux var
    # tmux set  -gq "${tv_ue_path_dirt}${pane_tty}" ${ueber_dirt}
    # tmux set  -gq "${tv_ue_path_fifo}${pane_tty}" ${ueber_fifo}
    # tmux show -g  "${tv_ue_path_fifo}${pane_tty}"
    # tmux show -gv "${tv_ue_path_fifo}${pane_tty}"
  # start ueberzug
  tail --follow "$ueber_fifo" \
    |ueberzug layer --silent --parser bash &
  echo
  echo "ueberzug start ..."
  echo
  }

stop_ueberzug() {
  # remove dirt & fifo
  pane_tty=$( tty |sed 's/\///g;s/dev//g' )
  ueber_dirt='/tmp/ueberzug_'"$pane_tty"
  ueber_fifo="$ueber_dirt"'/''ueberzug_fifo'
    # ueber_dirt=$( tmux show -gv "${tv_ue_path_dirt}${pane_tty}" )
    # ueber_fifo=$( tmux show -gv "${tv_ue_path_fifo}${pane_tty}" )
  echo $pane_tty $ueber_fifo
  rm     "$ueber_fifo"
  rm -rf "$ueber_dirt"
  echo
  echo 'rm dirt & fifo ...'
  echo
  # stop ueberzug
  tail_pid=$(  ps |grep 'tail'  |grep -Eo "^[[:space:]]*[0-9]+" )
  ueber_pid=$( ps |grep 'ueber' |grep -Eo "^[[:space:]]*[0-9]+" )
  echo $tail_pid $ueber_pid
  kill "$tail_pid"
  kill "$ueber_pid"
  echo
  echo "ueberzug stop ..."
  echo
  }


echo '========== =========='
ueber_count=$( ps |grep -c 'ueber' )
if   [ $ueber_count -eq 0 ] ;then
  # trap stop_ueberzug  EXIT QUIT INT TERM
  start_ueberzug
elif [ $ueber_count -eq 1 ] ;then
  stop_ueberzug
else
  killall ueberzug
  echo 'ueberzug already started ...'
  echo 'killall ueberzug ...'
  echo
fi

echo '========== =========='
exit $?


ueber_add.sh

#!/usr/bin/env bash


file_path=${1} # Full path of the previewed file
  x="$2"       # x coordinate of upper left cell of preview area
  y="$3"       # y coordinate of upper left cell of preview area
  w="$4"       # Width of the preview pane  (number of fitting characters)
  h="$5"       # Height of the preview pane (number of fitting characters)
pane_tty=$( \
  tmux display-message -p '#{pane_tty}' \
  |sed 's/\///g;s/dev//g' \
  )
ueber_count=$( ps -e \
  |grep "$( echo $pane_tty |sed 's/.\{3\}/&\//' )" \
  |grep -c 'ueber' \
  )
ueber_dirt='/tmp/ueberzug_'"$pane_tty"
ueber_fifo="$ueber_dirt"'/''ueberzug_fifo'
  # echo $pane_tty $ueber_count $ueber_fifo
  # read -p ''
  # tmux display-message  "$pane_tty $ueber_fifo"
  # tmux display-message  "$pane_tty $FILE_PATH"
  # tmux display-message  "$pane_tty $x $y $w $h"

check_init() {
  [ ! -e $ueber_fifo ] && exit
  [ $ueber_count -eq 0 ] && exit
  }

add_image() {
  [ $( echo $file_path |grep -c ' ' ) -gt 0 ] && return
    cw=$( tmux display-message -p '#{window_cell_width}'  )
    ch=$( tmux display-message -p '#{window_cell_height}' )
    fw=$( \
      exiftool $file_path \
      |grep -Ei '^[[:space:]]*Image Width' \
      |grep -Eo '[0-9]*' \
      )
    fh=$( \
      exiftool $file_path \
      |grep -Ei '^[[:space:]]*Image Height' \
      |grep -Eo '[0-9]*' \
      )
    ww=$( echo "$w*$cw" |bc )
    hh=$( echo "$h*$ch" |bc )

  if   [ $fw -le $ww ] && [ $fh -le $hh ] ;then
    w=$( echo "$fw/$cw" |bc )
    h=$( echo "$fh/$ch" |bc )
  elif [ $fw -gt $fh ] ;then
    w=$( echo "$w-1"              |bc )
    h=$( echo "($ww*$fh/$fw)/$ch" |bc )
  elif [ $fh -gt $fw ] ;then
    h=$( echo "$h-1"              |bc )
    w=$( echo "($hh*$fw/$fh)/$cw" |bc )
  elif [ $fw -eq $fh ] ;then
    w=$( echo "$w-2" |bc )
    h=$( echo "$h-1" |bc )
  fi
  # tmux display-message "$id $w $h $ww $hh $fw $fh"

  >"${ueber_fifo}" \
    declare -Ap add_command=( \
      [action]="add" \
      [identifier]="$pane_tty" \
      [path]="${file_path}" \
      [x]="$x" \
      [y]="$y" \
      [width]="$w" \
      [height]="$h" \
      [scaling_position_x]=0.5 \
      [scaling_position_y]=0.5 \
      [scaler]=forced_cover \
      )

  }

rmv_image() {
  >"${ueber_fifo}" \
    declare -Ap remove_command=( \
      [action]="remove" \
      [identifier]="$pane_tty" \
      )
  }

add_text() {
  exiftool $file_path
  }

extension=$(echo $file_path |grep -Eo "[a-zA-Z0-9]*$")
  # mimetype=$(file --mime-type -Lb "$file_path")
  # extension=$(echo "${file_path##*.}" | awk '{print tolower($0)}')
  # tmux display-message  "$pane_tty $mimetype $extension"

case "$extension" in
  jpg | png )
    # add_text
    check_init
    rmv_image
    add_image
    exit 0
    ;;
  *)
    check_init
    rmv_image
    exit
    ;;
esac


ueber_rmv.sh

#!/usr/bin/env bash


pane_tty=$( \
  tmux display-message -p '#{pane_tty}' \
  |sed 's/\///g;s/dev//g' \
  )
ueber_dirt='/tmp/ueberzug_'"$pane_tty"
ueber_fifo="$ueber_dirt"'/''ueberzug_fifo'

rmv_image() {
  [ ! -e $ueber_fifo ] && exit
  >"${ueber_fifo}" \
    declare -Ap remove_command=( \
      [action]="remove" \
      [identifier]="$pane_tty" \
      )
  }

rmv_image


@sxyazi
Copy link
Owner

sxyazi commented Nov 11, 2024

Again, I'm pretty sure this isn't an issue with Yazi, but I'd be happy if you could debug it and prove me wrong - you can find the implementation of ueberzugpp at https://github.com/sxyazi/yazi/blob/main/yazi-adapter/src/ueberzug.rs

Basically, it only does two things:

  1. Starts ueberzugpp: in your case, the specific command is ueberzugpp layer -so wayland, since you're on Wayland

    fn create_demon(adapter: Adapter) -> Result<Child> {
    let result = Command::new("ueberzugpp")
    .args(["layer", "-so", &adapter.to_string()])
    .env("SPDLOG_LEVEL", if cfg!(debug_assertions) { "debug" } else { "" })
    .kill_on_drop(true)
    .stdin(Stdio::piped())
    .stdout(Stdio::null())
    .stderr(Stdio::null())
    .spawn();

  2. Sends commands to ueberzugpp to request it display images.

    let s = format!(
    r#"{{"action":"add","identifier":"yazi","x":{},"y":{},"max_width":{},"max_height":{},"path":"{}"}}{}"#,
    rect.x,
    rect.y,
    rect.width,
    rect.height,
    path.to_string_lossy(),
    "\n"
    );

As you can see, Yazi doesn't handle any actual image display itself; it simply launches ueberzugpp and sends basic commands — that's all.

@ovwxxwvo
Copy link
Author

ovwxxwvo commented Nov 11, 2024

i just know how to connect ueberzug by fifo, could you show me how to connect by socket.
yazi auto run ueberzug by socket, stuck me to run it by fifo.
and how can I disable the ueberzug auto launch.

@ovwxxwvo
Copy link
Author

ovwxxwvo commented Nov 11, 2024

crash down my terminal emulator must be yazi itself, maybe the preload plugin.

@ovwxxwvo
Copy link
Author

oh, my fault, just crash down terminal by ueberzugpp, with small width & height,
the bug may ueberzugpp have, but not ueberzug.

@ovwxxwvo
Copy link
Author

ovwxxwvo commented Nov 12, 2024

better not to auto start the ueberzugpp.

@ovwxxwvo
Copy link
Author

ovwxxwvo commented Nov 12, 2024

I already turn off the preview image plugin, but ueberzugpp still run, how can turn it off.
I am giving up ueberzugpp for the time being.

Again, I'm pretty sure this isn't an issue with Yazi, but I'd be happy if you could debug it and prove me wrong - you can find the implementation of ueberzugpp at https://github.com/sxyazi/yazi/blob/main/yazi-adapter/src/ueberzug.rs

Basically, it only does two things:

1. Starts `ueberzugpp`: in your case, the specific command is `ueberzugpp layer -so wayland`, since you're on Wayland
   https://github.com/sxyazi/yazi/blob/fd8871d87859b13bb8038862350000fd132e0da3/yazi-adapter/src/ueberzug.rs#L84-L92

2. Sends commands to `ueberzugpp` to request it display images.
   https://github.com/sxyazi/yazi/blob/fd8871d87859b13bb8038862350000fd132e0da3/yazi-adapter/src/ueberzug.rs#L118-L126

As you can see, Yazi doesn't handle any actual image display itself; it simply launches ueberzugpp and sends basic commands — that's all.

@sxyazi
Copy link
Owner

sxyazi commented Nov 12, 2024

I suggest reporting this issue to ueberzugpp to get it fixed instead of simply disabling it, that way can help more people who might encounter the same problem.

However, if you really want to disable ueberzugpp: Yazi doesn't start ueberzugpp automatically, it only launches it on demand as a fallback when you request to display an image and your terminal doesn't support any built-in image protocols.

Specifically, the image_show() API might trigger it, so you'll need to disable all plugins that include image_show().

@ovwxxwvo
Copy link
Author

ovwxxwvo commented Nov 12, 2024

@sxyazi
I already add a comment at the ueberzugpp existing issue that you send me before.
I think not quite easy to fix it, I am thinking do some trick in other. wait for me to come back.


Is this somehow turn it off ?

  previewers = [
  	{ name = "*/", run = "folder", sync = true },
  	# Code
  	{ mime = "text/*", run = "code" },
  	{ mime = "*/{xml,javascript,x-wine-extension-ini}", run = "code" },
  	# Archive
  	{ mime = "application/{,g}zip", run = "archive" },
  	{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar,iso9660-image}", run = "archive" },
  	# Empty file
  	{ mime = "inode/x-empty", run = "empty" },
  	# Fallback
  	{ name = "*", run = "file" },

  	# { mime = "image/*", run = "image" },

    ]

but...

>>> >>>  ps -ef |grep -v 'grep' |grep -E 'PID|ueber'
UID          PID    PPID  C STIME TTY          TIME CMD
oo        160712  160622  0 Nov12 pts/6    00:00:04 ueberzugpp layer -so wayland
oo        324344  324322  0 Nov12 pts/1    00:00:01 ueberzugpp layer -so wayland
oo        326136  326114  0 Nov12 pts/2    00:00:01 ueberzugpp layer -so wayland
oo        429974  429952  0 00:21 pts/3    00:00:00 ueberzugpp layer -so wayland

better to get a preview toggle, a toggle to start|stop ueberzug like I do.
no need to make occasional things happen regularly.

@ovwxxwvo
Copy link
Author

I suggest reporting this issue to ueberzugpp to get it fixed instead of simply disabling it, that way can help more people who might encounter the same problem.

However, if you really want to disable ueberzugpp: Yazi doesn't start ueberzugpp automatically, it only launches it on demand as a fallback when you request to display an image and your terminal doesn't support any built-in image protocols.

Specifically, the image_show() API might trigger it, so you'll need to disable [all plugins that include image_show()](https://github.com/search?q=repo%3Asxyazi%2Fyazi%20ya.image_show(&type=code).

hey again, what inside 'self.area', how can I get the x&y , I am almost there.

function M:peek()
-- local function peek()

	local start, url = os.clock(), ya.file_cache(self)
	if not url or not fs.cha(url) then
		url = self.file.url
	  end

	ya.sleep(math.max(0, PREVIEW.image_delay / 1000 + start - os.clock()))
	ya.image_show(url, self.area)

@ovwxxwvo
Copy link
Author

@sxyazi hey, I knew it. "x,y,w,h" inside area.

@ovwxxwvo
Copy link
Author

ovwxxwvo commented Nov 15, 2024

@sxyazi hey, is this conflict.
when I trying to get the output of the script, ya.notifyjust not pop out.

local state = os.execute( cmd )
state = state - status

ya.notify {
  title = "mpserver",
  content = state,
  timeout = 2.0,
  }

@ovwxxwvo
Copy link
Author

ovwxxwvo commented Nov 17, 2024

@sxyazi hey dear, I have completed the shell script plugin for peek fn.
where the plugin entry for the fn that to remove the show of the image.
By the way, is that yazi need to deal the preview thing inside.
ueber run with yazi, a little bit annoying. Help me get rid of it.

@ovwxxwvo
Copy link
Author

@ @sxyazi hey, how can I add a previewer to the Adapter,
that not inside yazi, but as a plugin. I don't want to change the code here.

impl Adapter {
	pub async fn image_show(self, path: &Path, max: Rect) -> Result<Rect> {
		if max.is_empty() {
			return Ok(Rect::default());
		}

		match self {
			Self::Kgp => Kgp::image_show(path, max).await,
			Self::KgpOld => KgpOld::image_show(path, max).await,
			Self::Iip => Iip::image_show(path, max).await,
			Self::Sixel => Sixel::image_show(path, max).await,
			Self::X11 | Self::Wayland => Ueberzug::image_show(path, max).await,
			Self::Chafa => Chafa::image_show(path, max).await,
		}
	}

	pub fn image_hide(self) -> Result<()> {
		if let Some(area) = SHOWN.swap(None) { self.image_erase(*area) } else { Ok(()) }
	}

	pub fn image_erase(self, area: Rect) -> Result<()> {
		match self {
			Self::Kgp => Kgp::image_erase(area),
			Self::KgpOld => KgpOld::image_erase(area),
			Self::Iip => Iip::image_erase(area),
			Self::Sixel => Sixel::image_erase(area),
			Self::X11 | Self::Wayland => Ueberzug::image_erase(area),
			Self::Chafa => Chafa::image_erase(area),
		}
	}

	#[inline]
	pub fn shown_load(self) -> Option<Rect> { SHOWN.load_full().map(|r| *r) }

	#[inline]
	pub(super) fn shown_store(area: Rect) { SHOWN.store(Some(Arc::new(area))); }

	pub(super) fn start(self) { Ueberzug::start(self); }

	#[inline]
	pub(super) fn needs_ueberzug(self) -> bool {
		!matches!(self, Self::Kgp | Self::KgpOld | Self::Iip | Self::Sixel)
	}
}

@ovwxxwvo
Copy link
Author

@sxyazi hey dear, I have completed the shell script plugin for peek fn. where the plugin entry for the fn that to remove the show of the image. By the way, is that yazi need to deal the preview thing inside. ueber run with yazi, a little bit annoying. Help me get rid of it.

sudo pacman -Rscn ueberzugpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants