"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/preview-tabbed" between
nnn-v4.3.tar.gz and nnn-v4.4.tar.gz

About: nnn is a full-featured terminal file manager.

preview-tabbed  (nnn-v4.3):preview-tabbed  (nnn-v4.4)
#!/usr/bin/env bash #!/usr/bin/env bash
# Description: tabbed/xembed based file previewer # Description: tabbed/xembed based file previewer
# #
# Dependencies: # Dependencies:
# - tabbed (https://tools.suckless.org/tabbed): xembed host # - tabbed (https://tools.suckless.org/tabbed): xembed host
# - xterm (or urxvt or st) : xembed client for text-based preview # - xterm (or urxvt or st) : xembed client for text-based preview
# - mpv (https://mpv.io): xembed client for video/audio # - mpv (https://mpv.io): xembed client for video/audio
# - sxiv (https://github.com/muennich/sxiv): xembed client for images # - sxiv (https://github.com/muennich/sxiv) or,
# - nsxiv (https://github.com/nsxiv/nsxiv) : xembed client for images
# - zathura (https://pwmt.org/projects/zathura): xembed client for PDF # - zathura (https://pwmt.org/projects/zathura): xembed client for PDF
# - nnn's nuke plugin for text preview and fallback # - nnn's nuke plugin for text preview and fallback
# nuke is a fallback for 'mpv', 'sxiv', and 'zathura', but has its # nuke is a fallback for 'mpv', 'sxiv'/'nsxiv', and 'zathura', but has its
# own dependencies, see the script for more information # own dependencies, see the script for more information
# - vim (or any editor/pager really) # - vim (or any editor/pager really)
# - file # - file
# - mktemp # - mktemp
# - xdotool (optional, to keep main window focused) # - xdotool (optional, to keep main window focused)
# #
# Usage: # Usage:
# - Install the dependencies. Then set a NNN_FIFO # - Install the dependencies. Then set a NNN_FIFO
# and set a key for the plugin, then start `nnn`: # and set a key for the plugin, then start `nnn`:
# $ NNN_FIFO=/tmp/nnn.fifo nnn # $ NNN_FIFO=/tmp/nnn.fifo nnn
skipping to change at line 38 skipping to change at line 39
# common preview window. With different FIFO paths, they will be independen t. # common preview window. With different FIFO paths, they will be independen t.
# #
# How it works: # How it works:
# We use `tabbed` [1] as a xembed [2] host, to have a single window # We use `tabbed` [1] as a xembed [2] host, to have a single window
# owning each previewer window. So each previewer must be a xembed client. # owning each previewer window. So each previewer must be a xembed client.
# For text previewers, this is not an issue, as there are a lot of # For text previewers, this is not an issue, as there are a lot of
# xembed-able terminal emulator (we default to `xterm`, but examples are # xembed-able terminal emulator (we default to `xterm`, but examples are
# provided for `urxvt` and `st`). For graphic preview this can be trickier, # provided for `urxvt` and `st`). For graphic preview this can be trickier,
# but a few popular viewers are xembed-able, we use: # but a few popular viewers are xembed-able, we use:
# - `mpv`: multimedia player, for video/audio preview # - `mpv`: multimedia player, for video/audio preview
# - `sxiv`: image viewer # - `sxiv`/`nsxiv`: image viewer
# - `zathura`: PDF viewer # - `zathura`: PDF viewer
# - but we always fallback to `nuke` plugin # - but we always fallback to `nuke` plugin
# #
# [1]: https://tools.suckless.org/tabbed/ # [1]: https://tools.suckless.org/tabbed/
# [2]: https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.htm l # [2]: https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.htm l
# #
# Shell: Bash (job control is weakly specified in POSIX) # Shell: Bash (job control is weakly specified in POSIX)
# Author: Léo Villeveygoux # Author: Léo Villeveygoux
XDOTOOL_TIMEOUT=2 XDOTOOL_TIMEOUT=2
skipping to change at line 154 skipping to change at line 155
;; ;;
audio/*) audio/*)
if type mpv >/dev/null 2>&1 ; then if type mpv >/dev/null 2>&1 ; then
mpv --force-window=immediate --loop-file --wid="$XID" "$FILE " & mpv --force-window=immediate --loop-file --wid="$XID" "$FILE " &
else else
term_nuke "$XID" "$FILE" term_nuke "$XID" "$FILE"
fi fi
;; ;;
image/*) image/*)
if type sxiv >/dev/null 2>&1 ; then if type sxiv >/dev/null 2>&1 ; then
sxiv -e "$XID" "$FILE" & sxiv -ae "$XID" "$FILE" &
elif type nsxiv >/dev/null 2>&1 ; then
nsxiv -ae "$XID" "$FILE" &
else else
term_nuke "$XID" "$FILE" term_nuke "$XID" "$FILE"
fi fi
;; ;;
application/pdf) application/pdf)
if type zathura >/dev/null 2>&1 ; then if type zathura >/dev/null 2>&1 ; then
zathura -e "$XID" "$FILE" & zathura -e "$XID" "$FILE" &
else else
term_nuke "$XID" "$FILE" term_nuke "$XID" "$FILE"
fi fi
 End of changes. 4 change blocks. 
4 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)