mirror of
https://github.com/jarun/nnn.git
synced 2025-02-26 03:01:32 +00:00
integrated ueberzug into plugins/preview-tui
This commit is contained in:
parent
118657020e
commit
83232684a8
1 changed files with 12 additions and 1 deletions
|
@ -17,7 +17,7 @@
|
||||||
# - tar
|
# - tar
|
||||||
# - man
|
# - man
|
||||||
# - optional: bat for code syntax highlighting
|
# - optional: bat for code syntax highlighting
|
||||||
# - optional: kitty terminal or catimg for images
|
# - optional: kitty terminal, catimg, viu, or ueberzug for images
|
||||||
# - optional: scope.sh file viewer from ranger.
|
# - optional: scope.sh file viewer from ranger.
|
||||||
# To use:
|
# To use:
|
||||||
# 1. drop scope.sh executable in $PATH
|
# 1. drop scope.sh executable in $PATH
|
||||||
|
@ -171,6 +171,8 @@ preview_file () {
|
||||||
catimg "$1"
|
catimg "$1"
|
||||||
elif exists viu; then
|
elif exists viu; then
|
||||||
viu -t "$1"
|
viu -t "$1"
|
||||||
|
elif exists ueberzug; then
|
||||||
|
preview_ueberzug "$1"
|
||||||
else
|
else
|
||||||
fifo_pager print_bin_info "$1"
|
fifo_pager print_bin_info "$1"
|
||||||
fi
|
fi
|
||||||
|
@ -193,6 +195,15 @@ preview_file () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preview_ueberzug() {
|
||||||
|
height=$(tput lines)
|
||||||
|
width=$(tput cols)
|
||||||
|
ueberzug layer --parser json 0< <(
|
||||||
|
printf '{"action": "add", "identifier": "nnn_ueberzug", "x": 0, "y": 0, "max_width": "%s", "max_height": "%s", "path": "%s"}\n' "$width" "$height" "$1"
|
||||||
|
read
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$PREVIEW_MODE" ] ; then
|
if [ "$PREVIEW_MODE" ] ; then
|
||||||
if [ ! -r "$NNN_FIFO" ] ; then
|
if [ ! -r "$NNN_FIFO" ] ; then
|
||||||
echo "No FIFO available! (\$NNN_FIFO='$NNN_FIFO')" >&2
|
echo "No FIFO available! (\$NNN_FIFO='$NNN_FIFO')" >&2
|
||||||
|
|
Loading…
Add table
Reference in a new issue