Add kitty image previewer'

This commit is contained in:
fanyx 2024-02-22 09:44:36 +01:00
parent 2876aa3991
commit d356617460
3 changed files with 20 additions and 0 deletions

3
.config/lf/lf_kitty_clean Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty

13
.config/lf/lf_kitty_preview Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
file=$1
w=$2
h=$3
x=$4
y=$5
if [[ "$( file -Lb --mime-type "$file")" =~ ^image ]]; then
kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$file" < /dev/null > /dev/tty
exit 1
fi
# pistol "$file"

View File

@ -1,3 +1,7 @@
# kitty previewer
set previewer ~/.config/lf/lf_kitty_preview
set cleaner ~/.config/lf/lf_kitty_clean
# extract the current file with the right command # extract the current file with the right command
# (xkcd link: https://xkcd.com/1168/) # (xkcd link: https://xkcd.com/1168/)
cmd extract ${{ cmd extract ${{