From 1373d9ce7cdc833ebbf2787ccc8fda9b6c6783b8 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Fri, 13 Oct 2023 10:56:15 -0400 Subject: Debloat some more --- .config/vifm/scripts/vifmimg | 97 -------------------------------------------- 1 file changed, 97 deletions(-) delete mode 100755 .config/vifm/scripts/vifmimg (limited to '.config/vifm/scripts/vifmimg') 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 -- cgit v1.2.3