diff options
| -rw-r--r-- | mac/.config/lf/lfrc | 66 | ||||
| -rwxr-xr-x | mac/.config/lf/scope | 5 |
2 files changed, 36 insertions, 35 deletions
diff --git a/mac/.config/lf/lfrc b/mac/.config/lf/lfrc index 6243955..d9b92a1 100644 --- a/mac/.config/lf/lfrc +++ b/mac/.config/lf/lfrc @@ -1,4 +1,4 @@ -### --- Basic Settings --- ### +e### --- Basic Settings --- ### set autoquit true set cleaner '~/.config/lf/cleaner' set dircache false @@ -269,38 +269,38 @@ cmd mpvdir ${{ }} # Open -# cmd open ${{ -# case $(file --mime-type "$(readlink -f $f)" -b) in -# application/octet-stream) -# case ${f##*.} in -# doc|docx|xls|xlsx|odt|ppt|pptx) setsid -f libreoffice $fx >/dev/null 2>&1 ;; -# ghw) setsid -f gtkwave $f >/dev/null 2>&1 ;; -# ts) setsid -f mpv --x11-name=video $f -quiet >/dev/null 2>&1 ;; -# *) setsid -f zathura $fx >/dev/null 2>&1 ;; -# esac -# ;; -# application/epub*|application/pdf|application/postscript|application/vnd.djvu|image/vnd.djvu) setsid -f zathura $fx >/dev/null 2>&1 ;; -# application/pgp-encrypted) $EDITOR $fx ;; -# application/vnd.oasis.opendocument.text|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f firefox $fx >/dev/null 2>&1 ;; -# application/x-hwp|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.openxmlformats-officedocument.wordprocessingml.document) setsid -f libreoffice $fx >/dev/null 2>&1 ;; -# audio/*|video/x-ms-asf) setsid -f mpv --volume=50 --x11-name=music --force-window=yes --audio-display=embedded-first $f >/dev/null 2>&1 ;; -# image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; -# image/svg+xml) display -- $f ;; -# image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" | -# setsid -f nsxiv -aiop 2>/dev/null | while read -r file; do -# [ -z "$file" ] && continue -# lf -remote "send select \"$file\"" -# lf -remote "send toggle" -# done & -# ;; -# text/csv|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) sc-im $fx;; -# text/html|text/xml) lynx $fx;; -# text/troff) groff -mom $fx -Tpdf | zathura - ;; -# text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; -# video/*) setsid -f mpv --x11-name=video -quiet $f >/dev/null 2>&1 ;; -# *) for f in $fx; do setsid -f ${OPENER:-xdg-open} $f >/dev/null 2>&1; done;; -# esac -# }} +cmd open ${{ + case $(file --mime-type "$(readlink -f $f)" -b) in + application/octet-stream) + case ${f##*.} in + doc|docx|xls|xlsx|odt|ppt|pptx) open -a libreoffice $fx >/dev/null 2>&1 ;; + ghw) open -a gtkwave $f >/dev/null 2>&1 ;; + ts) open -a mpv --x11-name=video $f -quiet >/dev/null 2>&1 ;; + *) open -a zathura $fx >/dev/null 2>&1 ;; + esac + ;; + application/epub*|application/pdf|application/postscript|application/vnd.djvu|image/vnd.djvu) open -a zathura $fx >/dev/null 2>&1 ;; + application/pgp-encrypted) $EDITOR $fx ;; + application/vnd.oasis.opendocument.text|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) open -a firefox $fx >/dev/null 2>&1 ;; + application/x-hwp|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.openxmlformats-officedocument.wordprocessingml.document) open -a libreoffice $fx >/dev/null 2>&1 ;; + audio/*|video/x-ms-asf) open -a mpv --volume=50 --x11-name=music --force-window=yes --audio-display=embedded-first $f >/dev/null 2>&1 ;; + image/x-xcf) open -a gimp $f >/dev/null 2>&1 ;; + image/svg+xml) display -- $f ;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" | + open -a nsxiv -aiop 2>/dev/null | while read -r file; do + [ -z "$file" ] && continue + lf -remote "send select \"$file\"" + lf -remote "send toggle" + done & + ;; + text/csv|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) sc-im $fx;; + text/html|text/xml) lynx $fx;; + text/troff) groff -mom $fx -Tpdf | zathura - ;; + text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; + video/*) open -a mpv --x11-name=video -quiet $f >/dev/null 2>&1 ;; + *) for f in $fx; do open -a $f >/dev/null 2>&1; done;; + esac +}} # Rename cmd bulkrename ${{ diff --git a/mac/.config/lf/scope b/mac/.config/lf/scope index 9ea395f..c5d7c3e 100755 --- a/mac/.config/lf/scope +++ b/mac/.config/lf/scope @@ -52,8 +52,9 @@ text/troff) man ./ "$1" | col -b ;; text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4 - 2))" -f "$1" ;; audio/*) mediainfo "$1" || exit 1 ;; video/* | application/octet-stream | application/vnd.rn-realmedia) - 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.jpg" -s 0 -q 5 + # 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.jpg" -s 0 -q 5 image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; */pdf) |
