jarun / nnn

n³ The unorthodox terminal file manager
BSD 2-Clause "Simplified" License
18.59k stars 747 forks source link

Preview Not Working with tmux next 3.4 #1206

Closed levone1 closed 2 years ago

levone1 commented 2 years ago

Running nnn in tmux on SailfishOS; nnn is latest, built from source, and tmux is v. 3.4 next. Have been using with tmux 3.2, and previewer (tui) working fine, but now nothing - attempting to call preview causes a quick flash of the screen, and back to file list.

FIFO set, and all dependencies installed, plus some optionals...

Not sure if it's just the tmux version, or if there's anything I can do to test/troubleshoot ...

edit - switched to tmux 3.2a to test, and still not working. Seems to behave a little more normally now, showing "fifo not set" error when I start nnn without fifo, (wasn't doing that with 3.4), but still won't go into preview mode. Not sure where to look for problem...

imgview plugin working fine...

Thanks

jarun commented 2 years ago

I could compile, install and use tmux 3.2a released source without any issues.

tmux 3.4 is not a released version yet.

We will consider this as a tmux/local setup or config issue. Please debug yourself.

N-R-K commented 2 years ago

if there's anything I can do to test/troubleshoot

In the plugin script, there should be a lot of >/dev/null 2>&1 redirections. You can remove those and see what output you get.

showing "fifo not set" error when I start nnn without fifo

preview-tui needs fifo for it to work.

levone1 commented 2 years ago

N-R-K - thank you. That's what I was wondering. jarun - I assumed this had something to do with mu setup, since I had it working before. I just wasn't sure where to start trying to figure it oit...

Thanks

jarun commented 2 years ago

No problem!

Kabouik commented 2 years ago

I experience the same issue @levone1, but I seem to remember it was working before, around mid 2020. The reason I refer to so long ago is I haven't used nnn directly on SFOS since then, as I started using it in my Debian LXC container instead, and the issue occurs only in the host. The preview plugin has been evolving a lot in the past months, it might be worth trying an old commit of the script (before preview-tui-extended was added, even though it has now been merged with preview-tui).

On 2021-10-23 03:44 Terminator X @.***> wrote:

No problem!

--
You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/jarun/nnn/issues/1206#issuecomment-950037572

levone1 commented 2 years ago

@jarun - Taking tips from N-R-K, I was able to get some output, whick was along the lines of, "...unable to open /tmp/nnn-preview-tui-pagerpid no such file or directory..." Seems like it's failing to write something to /tmp... However, fifo files are written to tmp. Any ideas? Maybe I can try reinstalling...

jarun commented 2 years ago

@luukvbaal can you help with this?

luukvbaal commented 2 years ago

What is your NNN_FIFO set to?

luukvbaal commented 2 years ago

Does


@@ -84,6 +84,7 @@ NNN_PREVIEWDIR="${NNN_PREVIEWDIR:-$TMPDIR/nnn/previews}"
 NNN_PREVIEWWIDTH="${NNN_PREVIEWWIDTH:-1920}"
 NNN_PREVIEWHEIGHT="${NNN_PREVIEWHEIGHT:-1080}"
 NNN_PARENT="${NNN_FIFO#*.}"
+[ "$NNN_PARENT" -eq "$NNN_PARENT" ] 2>/dev/null || NNN_PARENT=""
 FIFOPID="$TMPDIR/nnn-preview-tui-fifopid.$NNN_PARENT"
 PREVIEWPID="$TMPDIR/nnn-preview-tui-pagerpid.$NNN_PARENT"
 CURSEL="$TMPDIR/nnn-preview-tui-selection.$NNN_PARENT"
``` change anything for you?
luukvbaal commented 2 years ago

I was able to reproduce similar errors with NNN_FIFO set to a path without an extension. #1208 should fix that case although it should have nothing to do with the tmux version idk if it will do anything for you.

preview-tui with tmux next-3.4 works fine on my end however.

levone1 commented 2 years ago

Built and installed with comits, and still the same. Now that I think about it, I don't think I have used preview on nnn since last SFOS update, (4.2). I wonder if some fs change is hindering it... @Kabouik - you're still on 3.4, right, or have yoy used preview successfully on 4.2?

Anyway, thank you all for support ... I'll keep messing around with it.

luukvbaal commented 2 years ago

Just to be sure, do you also update the plugins when you "build and install"?

levone1 commented 2 years ago

yes. Deleted nnn config dir...

luukvbaal commented 2 years ago

But have you tried the latest version of preview-tui? You need to run getplugs master or place it in your config dir manually.

levone1 commented 2 years ago

yes - just tried again to make sure ... Still the same. Let me know if any other ideas or any other info that might help .

0xACE commented 2 years ago

didn't read the thread

The following hasn't been tested safety squints are recommended when you use this foot cannon:

export NNN_FIFO="/tmp/nnn.fifo"
export NNN_PREVIEW="/tmp/nnn.fifo.preview"
mkfifo "$NNN_FIFO"
mkfifo "$NNN_PREVIEW"
curl -L https://raw.githubusercontent.com/jarun/nnn/master/plugins/preview-tui | sed -e 's/NNN_FIFO/NNN_PREVIEW/g' > ~/.config/nnn/plugins/preview-tui
chmod +x ~/.config/nnn/plugins/preview-tui
cat "$NNN_FIFO" | tee /tmp/nnn.fifo.log > "$NNN_PREVIEW" &
nnn # launch preview-tui within nnn
cat /tmp/nnn.fifo.log # paste the log

cap

luukvbaal commented 2 years ago

So just to be clear, is preview-tui now just no longer working for you? This issue is no longer dependent on the tmux version? Can you share your env?

Kabouik commented 2 years ago

I don't think we confirmed the issue is related to the tmux version. I doubt it is, because I packaged tmux next-3.2 for SFOS and I never updated it since then, yet previews used to work: here is an asciicast (https://asciinema.org/a/336443) I posted here. The nnn package (which I should update too) also shows working previews: https://openrepos.net/content/kabouik/nnn

That was long ago, before preview-tui and preview-tui-extended were split (and then merged back), and before viu was added as a preview option because I had to edit the script manually to use it (see info in the asciicast post). However, I just tested an old preview-tui commit from June 2020 (5a565675c0dca248915b048fc2c6bda7600d905e) and observed the same issue so it's unlikely to be due to the script itself. Does preview-tui depend on other scripts like .nmv?

@levone1, I'm still on SFOS 3.3 where the username is nemo, but that shouldn't change much.

On 2021-10-24 11:47 luukvbaal @.***> wrote:

So just to be clear, is just preview-tui is no longer working for you? This issue is no longer dependent on the tmux version? Can you share your env?

--
You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/jarun/nnn/issues/1206#issuecomment-950293541

Kabouik commented 2 years ago

This is my env on SFOS:

HOSTNAME=
GIO_LAUNCHED_DESKTOP_FILE_PID=11001
WAYLAND_DISPLAY=../../display/wayland-0
TERM=xterm-256color
SHELL=/bin/bash
QT_DF_SCALEFORNODEV=0.6
HISTSIZE=1000
QT_OPENGL_NO_BGRA=1
EGL_DRIVER=egl_gallium
QTCONTACTS_MANAGER_OVERRIDE=org.nemomobile.contacts.sqlite
QSG_FIXED_ANIMATION_STEP=no
AG_SERVICE_TYPES=/usr/share/accounts/service-types
QT_WAYLAND_FORCE_DPI=96
NNN_ARCHIVE=\.(7z|bz2|gz|tar|tgz|zip)$
NNN_PLUG=t:preview-tui;v:_viu $nnn;b:nbak;0:0x0;p:fzplug
USER=nemo
QT_DF_BASEDEVIATION=0.025
LIPSTICK_OPTIONS=-plugin evdevtouch:/dev/input/event1 -plugin evdevkeyboard:keymap=/usr/share/qt5/keymaps/droid.qmap -plugin evdevmouse
QT_WAYLAND_DISABLE_WINDOWDECORATION=1
QML_FIXED_ANIMATION_STEP=no
AG_SERVICES=/usr/share/accounts/services
MAIL=/var/spool/mail/nemo
PATH=/home/nemo/.cargo/bin:/home/nemo/.cargo/bin:/home/nemo/.local/bin/:/home/nemo/nodejs/node-v12.17.0-linux-armv7hl/bin/:/home/nemo/.cargo/bin/:/home/nemo/Templates/ghc/ghc-8.10.1/INSTALLDIR/bin:/home/nemo/Templates/llvm/clang+llvm-10.0.0-armv7a-linux-gnueabihf/bin:/home/nemo/Templates/gmp/gmp-6.2.0/INSTALLDIR:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:/usr/sbin
QT_IM_MODULE=Maliit
PWD=/home/nemo
EDITOR=kak
QT_DF_SCALEFORMAXDEV=0.37
LANG=en_GB.utf8
QT_GSTREAMER_CAMERABIN_SRC=droidcamsrc
QT_DF_RANGE=0.08
QT_QPA_PLATFORM=wayland
QT_DF_BASE=0.5
NNN_COLORS=4321
NOTIFY_SOCKET=/run/user/100000/systemd/notify
QT_WAYLAND_COMPOSITOR_NO_THROTTLE=1
EGL_PLATFORM=wayland
NNN_FIFO=/tmp/nnn.fifo
HISTCONTROL=ignoredups
NNN_TRASH=1
SHLVL=1
QT_GSTREAMER_CAMERABIN_FLAGS=15
HOME=/home/nemo
LOGNAME=nemo
AG_PROVIDERS=/usr/share/accounts/providers
VISUAL=kak
SESSION_TARGET=default.target
QT_GSTREAMER_PLAYBIN_FLAGS=0
XDG_DATA_DIRS=/home/nemo/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/100000/dbus/user_bus_socket
FZF_DEFAULT_COMMAND=set -o foobar; ls
QT_WAYLAND_RESIZE_AFTER_SWAP=1
MANAGERPID=5210
BROWSER=invoker -s --type=browser -G /usr/bin/sailfish-browser
XDG_RUNTIME_DIR=/run/user/100000
HYBRIS_LD_LIBRARY_PATH=/usr/libexec/droid-hybris/system/lib:/vendor/lib:/system/lib
QT_MESSAGE_PATTERN=[%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{function}:%{line} - %{message}
LIPSTICK2VNC_OPTS=
G_BROKEN_FILENAMES=1
COLORTERM=24bit
QMLSCENE_DEVICE=customcontext
BOOTSTATE=USER
_=/usr/bin/env
OLDPWD=/home/nemo/.config/nnn/plugins

And the .bashrc section relevant to nnn:

#################
# Aliases
#################

# nnn cd on quit with ^G
n ()
{
    # Block nesting of nnn in subshells
    if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then
        echo "nnn is already running"
        return
    fi

    # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set)
    # To cd on quit only on ^G, remove the "export" as in:
    #     NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
    # NOTE: NNN_TMPFILE is fixed, should not be modified
    NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"

    # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn
    # stty start undef
    # stty stop undef
    # stty lwrap undef
    # stty lnext undef
    # Add the command line options you want to combine with cd on quit here, then run nnn with just "n"
    nnn -aAS -P t "$@"

    if [ -f "$NNN_TMPFILE" ]; then
            . "$NNN_TMPFILE"
            rm -f "$NNN_TMPFILE" > /dev/null
    fi
}

#################
# Environment variables
#################

# Set default terminal editor
export EDITOR='kak'
export VISUAL='kak'

# viu
export COLORTERM='24bit'

# nnn
export NNN_COLORS='4321'
export NNN_PLUG='t:preview-tui;v:_viu $nnn;b:nbak;0:0x0;p:fzplug'
export NNN_FIFO='/tmp/nnn.fifo'
export NNN_TRASH=1
export NNN_ARCHIVE="\\.(7z|bz2|gz|tar|tgz|zip)$"

# lynx
alias lynx='lynx --display_charset=utf8' # enable accents in lynx

Note that this .bashrc was made for old nnn 3.2, since I now use more recent nnn versions in a Debian LXC container instead of directly in the SFOS host.

levone1 commented 2 years ago

0xACE - going to test later. I'm starting to wonder if recent encryption feature may be having an effect... @Kabouik - interesting about Linux container, because I also had used it successfully on Linux container, and now, the plugin functions normally in general, and shows previews for most files, but not images. Screenshot_20211024_002 Screenshot_20211024_001

Kabouik commented 2 years ago

I don't think it's related to encryption @levone1, because again I'm experiencing the same issue as you in 3.3 where disk encryption is not implemented yet. I also still see previews for images in my container (with nnn 4.0). I wonder if preview-tui calls other functions or scripts shipped with nnn that may be missing dependencies in SFOS, in which case I should try the old commit of preview-tui but also the old commits of the other functions/scripts it uses.

Maybe we should move the discussion with @luukvbaal to Gitter or IRC to avoid flooding everyone with Github notifications?

On 2021-10-24 14:24 levone1 @.***> wrote:

0xACE - going to test later. I'm starting to wonder if recent encryption feature may be having an effect... @Kabouik - interesting about Linux container, because I also had used it successfully on Linux container, and now, the plugin functions normally in general, and shows previews for most files, but not images. Screenshot_20211024_002 Screenshot_20211024_001

--
You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/jarun/nnn/issues/1206#issuecomment-950315836

levone1 commented 2 years ago

ok. I'm going to start looking from env angle... Seems like I may have tweaked a couple of things out of path...

luukvbaal commented 2 years ago

I'm not sure how to help you with this sorry. Keep running the script without error redirection to /dev/null and try to fix the environment.

preview-tui does not depend on any other plugins besides .iconlookup when set @Kabouik.

levone1 commented 2 years ago

So I was able to suppress things like

"unable to open /tmp/nnn-preview-tui-pagerpid no such file or directory"

with some exports, and what I now ger is

"Bridge.exe not found..."

luukvbaal commented 2 years ago

What do you mean you were able to suppress with some exports? Can you try to get rid of all the tmpfile variables i.e. FIFOPID PREVIEWPID CURSEL FIFO_UEBERZUG and hardcode to some location in your home folder instead?

Bridge.exe not found is expected when you remove error redirection but will not affect successful operation of the script.

levone1 commented 2 years ago

So that's pretty much what I did - first I went through variables and unset anything to do with nnn or fifo, etc., then when I go the error, e.g., "unable to open /tmp/nnn-preview-tui-pagerpid no such file or directory", I woul export, e.g., "NNN_PREVIEW_TUI=~/nnnpreviewtui", and same for fifo, after that, there were no more errors about "no such file..." - just the Bridge.exe error, but still no preview ...

luukvbaal commented 2 years ago

Still have no idea what would cause this sorry, besides not being in tmux...

levone1 commented 2 years ago

Thanks. I have a feeling it may have to do with my current SF setup, (also having issue with nnn preview in my Linux container, which has worked fine before). I'm always messing with things, so not unusual to run into these things... I'll probably clean-flash at some point, and try from there. I bet it will work fine.

Sent from Outlookhttp://aka.ms/weboutlook


From: luukvbaal @.> Sent: Saturday, October 30, 2021 3:12 AM To: jarun/nnn @.> Cc: levone1 @.>; Mention @.> Subject: Re: [jarun/nnn] Preview Not Working with tmux next 3.4 (Issue #1206)

Still have no idea what would cause this sorry, besides not being in tmux...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/jarun/nnn/issues/1206#issuecomment-955163637, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKIC4DOMGPBOXN44QTCNVDTUJOSFLANCNFSM5GQHQOTQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.