omerxx / tmux-floax

The missing floating pane for Tmux
GNU General Public License v3.0
413 stars 26 forks source link

Hangs whole tmux window with lf #18

Open Mugworth opened 3 months ago

Mugworth commented 3 months ago

Hello, I gues it can be pretty complex issue given lf scripts, but here we go:

To get issue :

It looks like this script i have is the cause of pain:

 --> cat .local/bin/lfub
#!/bin/sh
set -e

if [ -n "$DISPLAY" ]; then
  export FIFO_UEBERZUG="${TMPDIR:-/tmp}/lf-ueberzug-$$"

  cleanup() {
    exec 3>&-
    rm "$FIFO_UEBERZUG"
  }

  mkfifo "$FIFO_UEBERZUG"
  ueberzug layer -s <"$FIFO_UEBERZUG" &
  exec 3>"$FIFO_UEBERZUG"
  trap cleanup EXIT

  if ! [ -d "$HOME/.cache/lf" ]; then
    mkdir -p "$HOME/.cache/lf"
  fi

  lf "$@" 3>&-
else
  exec lf "$@"
fi

or

 --> cat .local/bin/lfub
#!/bin/sh
set -euf

if [ -n "${DISPLAY-}" ] && [ -z "${FIFO_UEBERZUG-}" ]; then
  export FIFO_UEBERZUG="${TMPDIR:-/tmp}/lf-ueberzug-$$"

  cleanup() {
    exec 3>&-
    rm -- "$FIFO_UEBERZUG"
  }

  mkfifo -- "$FIFO_UEBERZUG"
  # Execute ueberzug in a loop in case it crashes. Ueberzug dies if its
  # associated window is closed. This breaks image previews when using tmux and
  # reattaching to an existing session.
  while ! ueberzug layer -s <"$FIFO_UEBERZUG"; do :; done &
  # Open the FIFO for writing. FIFO readers receive an EOF once all writers
  # have closed their respective file descriptors. Holding a file descriptor
  # will effectively keep ueberzug alive as long as lf lives.
  exec 3>"$FIFO_UEBERZUG"
  trap cleanup EXIT

  [ -d "$HOME/.cache/lf" ] || mkdir -p -- "$HOME/.cache/lf"

  # Start lf without passing in the file descriptor. This is done to avoid the
  # lf server being passed the file descriptor, which would cause ueberzug to
  # live longer than is strictly necessary.
  lf "$@" 3>&-
else
  exec lf "$@"
fi

With both of them i get the same result. Do you have any idea what could cause it i'm not that well versed in bashism

Edit: Neovim don't have anything to do with it

omerxx commented 1 month ago

Interesting indeed, do you think this has something to do with lf running in the background (or front) preventing the keybinds from running?