diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2023-10-13 10:56:15 -0400 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2023-10-13 10:56:15 -0400 |
commit | 1373d9ce7cdc833ebbf2787ccc8fda9b6c6783b8 (patch) | |
tree | bc09a5481a97bd7d41cbb82a7b0c5bce30a7e68b /.config/vifm/scripts/vifmimg | |
parent | 05e4524de58829c042805042130f8a99c1a7c8e1 (diff) |
Debloat some more
Diffstat (limited to '.config/vifm/scripts/vifmimg')
-rwxr-xr-x | .config/vifm/scripts/vifmimg | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/.config/vifm/scripts/vifmimg b/.config/vifm/scripts/vifmimg deleted file mode 100755 index e45a903..0000000 --- a/.config/vifm/scripts/vifmimg +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env bash -readonly ID_PREVIEW="preview" - -# Preview an image file directly -function draw() { - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" - [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ - [path]="${PWD}/$6") \ - > "$FIFO_UEBERZUG" -} - -function font_preview() { - # if no preview found, generate one - if [ ! -f "/tmp${PWD}/$6.png" ]; then - fontpreview -i "$6" -o "/tmp${PWD}/$6.png" - fi - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" - [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ - [path]="/tmp${PWD}/$6.png") \ - > "$FIFO_UEBERZUG" -} - -function pdf_preview() { - # if no preview found, generate one - if [ ! -f "/tmp${PWD}/$6.png" ]; then - pdftoppm -png -singlefile "$6" "/tmp${PWD}/$6" - fi - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" - [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ - [path]="/tmp${PWD}/$6.png") \ - > "$FIFO_UEBERZUG" -} - -function audio_preview() { - # if no preview found, generate one - if [ ! -f "/tmp${PWD}/$6.png" ]; then - ffmpeg -i "$6" "/tmp${PWD}/$6.png" -y &> /dev/null - fi - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" - [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ - [path]="/tmp${PWD}/$6.png") \ - > "$FIFO_UEBERZUG" -} - -function video_preview() { - # if no preview found, generate one - if [ ! -f "/tmp${PWD}/$6.png" ]; then - ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp${PWD}/$6.png" -s 0 -q 10 - fi - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" - [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ - [path]="/tmp${PWD}/$6.png") \ - > "$FIFO_UEBERZUG" -} - -function epub_preview() { - if [ ! -f "/tmp$PWD/$6.png" ]; then - epub-thumbnailer "$6" "/tmp$PWD/$6.png" 1024 - fi - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" - [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ - [path]="/tmp$PWD/$6.png") \ - > "$FIFO_UEBERZUG" -} - -# clear preview image -function clear_preview() { - declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") \ - > "$FIFO_UEBERZUG" -} - -# Check all the dependencies that are needed to show all the file previews. -# The reason why we are sending a notification incase a dependency does not -# exist is because that is the easiest way to get the user's attention. -dependencies=(ffmpeg ffmpegthumbnailer fontpreview pdftoppm epub-thumbnailer) -for dependency in "${dependencies[@]}"; do - type -p "$dependency" &>/dev/null || { - notify-send "vifm" "Could not find '${dependency}', is it installed?" - exit 1 - } -done - - -# Make sure ueberzug's fifo exists -if [ -e "$FIFO_UEBERZUG" ]; then - # Make a temp dir for rendering if not exists - [ ! -d "/tmp${PWD}/" ] && mkdir -p "/tmp${PWD}/" - case "$1" in - draw) draw "$@" ;; - font) font_preview "$@" ;; - pdf) pdf_preview "$@" ;; - video) video_preview "$@" ;; - clear) clear_preview ;; - audio) audio_preview "$@" ;; - epub) epub_preview "$@" ;; - esac -fi |