vifm image previews script added

This commit is contained in:
Void Soul 2020-07-01 21:42:12 +05:30
parent c2d7cea122
commit 3055e353f7
5 changed files with 65 additions and 9 deletions

View File

@ -1,21 +1,28 @@
highlight clear
highlight Win cterm=none ctermfg=white ctermbg=black
highlight Directory cterm=bold ctermfg=cyan ctermbg=default
highlight Link cterm=bold ctermfg=blue ctermbg=default
highlight BrokenLink cterm=bold ctermfg=red ctermbg=default
" Highlight Borders That you may want to set to defalt to get complete transparency
highlight TopLine cterm=none ctermfg=white ctermbg=default " Top borders line
highlight TopLineSel cterm=bold ctermfg=white ctermbg=default " Top line Selected Directory
highlight CmdLine cterm=none ctermfg=white ctermbg=default " Bottom border line
highlight Border cterm=none ctermfg=white ctermbg=default " Middle border lines
highlight StatusLine cterm=bold ctermfg=white ctermbg=default " status bar line
highlight Win cterm=none ctermfg=white ctermbg=default " mostly inside background
highlight Directory cterm=bold ctermfg=cyan ctermbg=default " highlight directories
highlight Link cterm=bold ctermfg=blue ctermbg=default " highlight symbolic link
highlight BrokenLink cterm=bold ctermfg=red ctermbg=default " highlight broken symbolic link
" most other highlights are obvious so need to comment out
highlight Socket cterm=bold ctermfg=magenta ctermbg=default
highlight Device cterm=bold ctermfg=red ctermbg=default
highlight Fifo cterm=bold ctermfg=cyan ctermbg=default
highlight Executable cterm=bold ctermfg=green ctermbg=default
highlight Selected cterm=bold ctermfg=magenta ctermbg=default
highlight CurrLine cterm=bold,reverse ctermfg=default ctermbg=default
highlight TopLine cterm=none ctermfg=black ctermbg=white
highlight TopLineSel cterm=bold ctermfg=black ctermbg=default
highlight StatusLine cterm=bold ctermfg=black ctermbg=blue
highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black
highlight CmdLine cterm=none ctermfg=white ctermbg=black
highlight ErrorMsg cterm=none ctermfg=red ctermbg=black
highlight Border cterm=none ctermfg=white ctermbg=black
highlight JobLine cterm=bold,reverse ctermfg=black ctermbg=white
highlight SuggestBox cterm=bold ctermfg=default ctermbg=default
highlight CmpMismatch cterm=bold ctermfg=white ctermbg=red

View File

@ -0,0 +1,6 @@
This directory is dedicated for user-supplied scripts/executables.
vifm modifies its PATH environment variable to let user run those
scripts without specifying full path. All subdirectories are added
as well. File in a subdirectory overrules file with the same name
in parent directories. Restart might be needed to recognize files
in newly created or renamed subdirectories.

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
[ -z "$FIFO_UEBERZUG" ] && exit
readonly ID_PREVIEW="preview"
if [ "$1" = "draw" ]; then
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="${PWD}/$6") > "$FIFO_UEBERZUG"
elif [ "$1" = "videopreview" ]; then
[ ! -f "/tmp/$6.png" ] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp/$6.png" -s 0 -q 10 &&
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="/tmp/$6.png") > "$FIFO_UEBERZUG"
else
declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") > "$FIFO_UEBERZUG"
fi

14
.config/vifm/scripts/vifmimg Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
readonly ID_PREVIEW="preview"
if [ -e "$FIFO_UEBERZUG" ]; then
if [[ "$1" == "draw" ]]; then
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \
[path]="${PWD}/$6") \
> "$FIFO_UEBERZUG"
else
declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") \
> "$FIFO_UEBERZUG"
fi
fi

15
.config/vifm/scripts/vifmrun Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}"
function cleanup {
rm "$FIFO_UEBERZUG" 2>/dev/null
pkill -P $$ 2>/dev/null
}
rm "$FIFO_UEBERZUG" 2>/dev/null
mkfifo "$FIFO_UEBERZUG"
trap cleanup EXIT
tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash &
vifm
cleanup