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

Hangs whole tmux window with lf #18

Open
Mugworth opened this issue Jul 23, 2024 · 1 comment
Open

Hangs whole tmux window with lf #18

Mugworth opened this issue Jul 23, 2024 · 1 comment

Comments

@Mugworth
Copy link

Mugworth commented Jul 23, 2024

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

  • tmux version 3.4
  • lf 32

To get issue :

  • Open floatx
  • open lf inside of floatx
  • Try to detach(meaning hiding the window)
  • image
  • Gets input but does't respond to signals from keyboard like SIGINT from C-c for example or any tmux keybindings

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

@Mugworth Mugworth changed the title Hangs whole tmux with nvim and lf Hangs whole tmux window with lf Jul 25, 2024
@omerxx
Copy link
Owner

omerxx commented Sep 21, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants