diff options
Diffstat (limited to '.config/lf')
-rwxr-xr-x | .config/lf/cleaner | 4 | ||||
-rw-r--r-- | .config/lf/icons | 77 | ||||
-rw-r--r-- | .config/lf/lfrc | 25 | ||||
-rwxr-xr-x | .config/lf/scope | 13 |
4 files changed, 119 insertions, 0 deletions
diff --git a/.config/lf/cleaner b/.config/lf/cleaner new file mode 100755 index 0000000..1227249 --- /dev/null +++ b/.config/lf/cleaner @@ -0,0 +1,4 @@ +#!/bin/sh +#rm ~/.cache/lf/* -f +exec kitty +kitten icat --clear --stdin no --silent --transfer-mode file </dev/null >/dev/tty + diff --git a/.config/lf/icons b/.config/lf/icons new file mode 100644 index 0000000..aad068c --- /dev/null +++ b/.config/lf/icons @@ -0,0 +1,77 @@ +di 📁 +fi 📃 +tw 🤝 +ow 📂 +ln ⛓ +or ❌ +ex 🎯 +*.txt ✍ +*.mom ✍ +*.me ✍ +*.ms ✍ +*.avif 🖼 +*.png 🖼 +*.webp 🖼 +*.ico 🖼 +*.jpg 📸 +*.jpe 📸 +*.jpeg 📸 +*.gif 🖼 +*.svg 🗺 +*.tif 🖼 +*.tiff 🖼 +*.xcf 🖌 +*.html 🌎 +*.xml 📰 +*.gpg 🔒 +*.css 🎨 +*.pdf 📚 +*.djvu 📚 +*.epub 📚 +*.csv 📓 +*.xlsx 📓 +*.tex 📜 +*.md 📘 +*.r 📊 +*.R 📊 +*.rmd 📊 +*.Rmd 📊 +*.m 📊 +*.mp3 🎵 +*.opus 🎵 +*.ogg 🎵 +*.m4a 🎵 +*.flac 🎼 +*.wav 🎼 +*.mkv 🎥 +*.mp4 🎥 +*.webm 🎥 +*.mpeg 🎥 +*.avi 🎥 +*.mov 🎥 +*.mpg 🎥 +*.wmv 🎥 +*.m4b 🎥 +*.flv 🎥 +*.zip 📦 +*.rar 📦 +*.7z 📦 +*.tar 📦 +*.z64 🎮 +*.v64 🎮 +*.n64 🎮 +*.gba 🎮 +*.nes 🎮 +*.gdi 🎮 +*.1 ℹ +*.nfo ℹ +*.info ℹ +*.log 📙 +*.iso 📀 +*.img 📀 +*.bib 🎓 +*.ged 👪 +*.part 💔 +*.torrent 🔽 +*.jar ♨ +*.java ♨ diff --git a/.config/lf/lfrc b/.config/lf/lfrc new file mode 100644 index 0000000..56ca258 --- /dev/null +++ b/.config/lf/lfrc @@ -0,0 +1,25 @@ +set ifs "\n" +set icons +set sixel true +set cleaner ~/.config/lf/cleaner +set previewer ~/.config/lf/scope + +cmd open ${{ + case $(file --mime-type "$(readlink -f $f)" -b) in + text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; + video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + audio/*|video/x-ms-asf) mpv --audio-display=no $f ;; + *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; + esac +}} + +cmd delete ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "delete?[y/N]" + read ans + [ $ans = "y" ] && rm -rf -- $fx +}} + +map D delete diff --git a/.config/lf/scope b/.config/lf/scope new file mode 100755 index 0000000..b79c4b6 --- /dev/null +++ b/.config/lf/scope @@ -0,0 +1,13 @@ +#!/bin/sh +case "$(file -Lb --mime-type -- "$1")" in + image/*) + chafa -f sixel -s "$2x$3" --animate off --polite on "$1" + exit 1 + ;; + text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;; + audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; + video/*) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + chafa -f sixel -s "$2x$3" --animate off --polite on "$CACHE" +esac |