diff options
author | awy <awy@tutamail.com> | 2024-08-27 03:44:14 +0300 |
---|---|---|
committer | awy <awy@tutamail.com> | 2024-08-27 03:44:14 +0300 |
commit | 8c24921832b2b6dc95bbb41dbfe2de7ff4fcf877 (patch) | |
tree | b8bfc2d150de60d0f989843cb67bc0c6fd380366 /.config/lf | |
parent | 01b0a486d1190b88ee40458b4e16bcd6fa0c93bc (diff) |
update
Diffstat (limited to '.config/lf')
-rwxr-xr-x | .config/lf/cleaner | 2 | ||||
-rwxr-xr-x | .config/lf/kitty_scope | 29 | ||||
-rwxr-xr-x | .config/lf/scope | 28 |
3 files changed, 23 insertions, 36 deletions
diff --git a/.config/lf/cleaner b/.config/lf/cleaner index 9b48783..1227249 100755 --- a/.config/lf/cleaner +++ b/.config/lf/cleaner @@ -1,4 +1,4 @@ #!/bin/sh #rm ~/.cache/lf/* -f -#exec kitty +kitten icat --clear --stdin no --silent --transfer-mode file </dev/null >/dev/tty +exec kitty +kitten icat --clear --stdin no --silent --transfer-mode file </dev/null >/dev/tty diff --git a/.config/lf/kitty_scope b/.config/lf/kitty_scope deleted file mode 100755 index a7d0bc1..0000000 --- a/.config/lf/kitty_scope +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -draw() { - kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$1" </dev/null >/dev/tty - exit 1 -} - -file="$1" -w="$2" -h="$3" -x="$4" -y="$5" - -case "$(file -Lb --mime-type "$file")" in - image/*) - draw "$file" - ;; - audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; - video/*) - # vidthumb is from here: - # https://raw.githubusercontent.com/duganchen/kitty-pistol-previewer/main/vidthumb - 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 - draw "$CACHE" - #draw "$(vidthumb "$file")" - ;; - text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;; -esac - -#pistol "$file"lace "${2}x${3}@${4}x${5}" "$1" diff --git a/.config/lf/scope b/.config/lf/scope index b79c4b6..a7d0bc1 100755 --- a/.config/lf/scope +++ b/.config/lf/scope @@ -1,13 +1,29 @@ #!/bin/sh -case "$(file -Lb --mime-type -- "$1")" in +draw() { + kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$1" </dev/null >/dev/tty + exit 1 +} + +file="$1" +w="$2" +h="$3" +x="$4" +y="$5" + +case "$(file -Lb --mime-type "$file")" in image/*) - chafa -f sixel -s "$2x$3" --animate off --polite on "$1" - exit 1 + draw "$file" ;; - 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 ;; + audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; video/*) + # vidthumb is from here: + # https://raw.githubusercontent.com/duganchen/kitty-pistol-previewer/main/vidthumb 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" + draw "$CACHE" + #draw "$(vidthumb "$file")" + ;; + text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;; esac + +#pistol "$file"lace "${2}x${3}@${4}x${5}" "$1" |