summaryrefslogtreecommitdiff
path: root/mac/.config/lf
diff options
context:
space:
mode:
Diffstat (limited to 'mac/.config/lf')
-rwxr-xr-xmac/.config/lf/cleaner4
-rw-r--r--mac/.config/lf/lfrc66
-rwxr-xr-xmac/.config/lf/scope14
3 files changed, 45 insertions, 39 deletions
diff --git a/mac/.config/lf/cleaner b/mac/.config/lf/cleaner
index a380dcd..a5f68d5 100755
--- a/mac/.config/lf/cleaner
+++ b/mac/.config/lf/cleaner
@@ -1,5 +1,5 @@
#!/bin/sh
-if [ -n "$FIFO_UEBERZUGPP" ]; then
- printf '{"action": "remove", "identifier": "PREVIEW"}\n' >"$FIFO_UEBERZUGPP"
+if command -v kitty >/dev/null 2>&1; then
+ kitty +kitten icat --silent --stdin no --transfer-mode file --clear >/dev/tty
fi
diff --git a/mac/.config/lf/lfrc b/mac/.config/lf/lfrc
index 661ccf3..6243955 100644
--- a/mac/.config/lf/lfrc
+++ b/mac/.config/lf/lfrc
@@ -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) 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
+# }}
# Rename
cmd bulkrename ${{
@@ -536,7 +536,7 @@ map th $nsxiv -apt "$(pwd)"
# Open
map O $mimeopen "$f"
-map o open
+map o open "$f"
map <c-o> $mimeopen --ask "$f"
# Paste
diff --git a/mac/.config/lf/scope b/mac/.config/lf/scope
index fc26f5e..2a2f7fa 100755
--- a/mac/.config/lf/scope
+++ b/mac/.config/lf/scope
@@ -7,10 +7,16 @@ IFS="$(printf '%b_' '\n')"
IFS="${IFS%_}"
image() {
- if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzugpp >/dev/null 2>&1; then
- printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$(($5 + 1))" "$(($2 - 1))" "$(($3 - 2))" "$1" >"$FIFO_UEBERZUGPP"
+ if [ -f "$1" ] && command -v kitty >/dev/null 2>&1; then
+ file=$1
+ w=$2
+ h=$3
+ x=$4
+ y=$5
+ kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$file" </dev/null >/dev/tty
mediainfo --Output="Video;%Duration/String%" "$6"
else
+ chafa "$1" -s "$4x"
mediainfo "$6"
fi
}
@@ -30,12 +36,12 @@ image/vnd.djvu)
[ ! -f "$CACHE" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | magick -density 200 - "$CACHE.jpg" >/dev/null 2>&1
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"
;;
-image/svg+xml)
+image/svg+xml | image/png)
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" ] && inkscape --convert-dpi-method=none -o "$CACHE.png" --export-overwrite -D --export-png-color-mode=RGBA_16 "$1"
image "$CACHE.png" "$2" "$3" "$4" "$5" "$1"
;;
-image/x-xcf)
+image/x-xcf | image/jpg | image/jpeg)
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 | awk '{print $1}')"
[ ! -f "$CACHE.jpg" ] && magick "$1[0]" "$CACHE.jpg"
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"