lf tweaks included ueberzug images
This commit is contained in:
parent
d9fb1ad732
commit
148f1432e6
4 changed files with 37 additions and 3 deletions
|
@ -8,6 +8,8 @@ set scrolloff 10
|
||||||
set icons
|
set icons
|
||||||
set period 1
|
set period 1
|
||||||
set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
|
set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
|
||||||
|
set ratios 1:2:3
|
||||||
|
set cleaner ~/.local/bin/lf-cleaner
|
||||||
|
|
||||||
# Vars that depend on environmental variables
|
# Vars that depend on environmental variables
|
||||||
$lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope"
|
$lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope"
|
||||||
|
@ -15,8 +17,9 @@ $lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope"
|
||||||
# cmds/functions
|
# cmds/functions
|
||||||
cmd open ${{
|
cmd open ${{
|
||||||
case $(file --mime-type "$(readlink -f $f)" -b) in
|
case $(file --mime-type "$(readlink -f $f)" -b) in
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
|
||||||
image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
|
image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
|
||||||
text/*) $EDITOR $fx;;
|
text/*|application/json|inode/x-empty) $EDITOR $fx;;
|
||||||
image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
|
image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
|
||||||
image/svg+xml) display -- $f ;;
|
image/svg+xml) display -- $f ;;
|
||||||
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | setsid -f sxiv -aio 2>/dev/null | lf-select & ;;
|
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | setsid -f sxiv -aio 2>/dev/null | lf-select & ;;
|
||||||
|
@ -94,8 +97,8 @@ map O $mimeopen --ask $f
|
||||||
map A rename # at the very end
|
map A rename # at the very end
|
||||||
map c push A<c-u> # new rename
|
map c push A<c-u> # new rename
|
||||||
map I push A<c-a> # at the very beginning
|
map I push A<c-a> # at the very beginning
|
||||||
map i push A<a-b><a-b><a-f> # before extension
|
map i push A<a-b><a-b><a-f> # before extention
|
||||||
map a push A<a-b> # after extension
|
map a push A<a-b> # after extention
|
||||||
map B bulkrename
|
map B bulkrename
|
||||||
map b $setbg $f
|
map b $setbg $f
|
||||||
|
|
||||||
|
@ -105,5 +108,7 @@ map V push :!nvim<space>
|
||||||
|
|
||||||
map W $setsid -f $TERMINAL >/dev/null 2>&1
|
map W $setsid -f $TERMINAL >/dev/null 2>&1
|
||||||
|
|
||||||
|
map Y $printf "%s" "$fx" | xclip -selection clipboard
|
||||||
|
|
||||||
# Source Bookmarks
|
# Source Bookmarks
|
||||||
source "~/.config/lf/shortcutrc"
|
source "~/.config/lf/shortcutrc"
|
||||||
|
|
|
@ -45,6 +45,7 @@ alias \
|
||||||
z="zathura"
|
z="zathura"
|
||||||
|
|
||||||
alias \
|
alias \
|
||||||
|
lf="lfub" \
|
||||||
magit="nvim -c MagitOnly" \
|
magit="nvim -c MagitOnly" \
|
||||||
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
|
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
|
||||||
weath="less -S ${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" \
|
weath="less -S ${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" \
|
||||||
|
|
4
.local/bin/lf-cleaner
Executable file
4
.local/bin/lf-cleaner
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
if [ -n "$FIFO_UEBERZUG" ]; then
|
||||||
|
printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG"
|
||||||
|
fi
|
24
.local/bin/lfub
Executable file
24
.local/bin/lfub
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This is a wrapper script for lb that allows it to create image previews with
|
||||||
|
# ueberzug. This works in concert with the lf configuration file and the
|
||||||
|
# lf-cleaner script.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
exec 3>&-
|
||||||
|
rm "$FIFO_UEBERZUG"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
|
||||||
|
lf "$@"
|
||||||
|
else
|
||||||
|
[ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf"
|
||||||
|
export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
|
||||||
|
mkfifo "$FIFO_UEBERZUG"
|
||||||
|
ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
|
||||||
|
exec 3>"$FIFO_UEBERZUG"
|
||||||
|
trap cleanup EXIT
|
||||||
|
lf "$@" 3>&-
|
||||||
|
fi
|
Loading…
Reference in a new issue