summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2021-05-26 04:43:24 +0200
committerache <ache@ache.one>2021-05-26 04:43:24 +0200
commit711b7cfd9ba4acda7e39ad7ba44345f0ba9457ae (patch)
tree7c5e452dc0b6b10bfed8fe39befc8c61bf24fe7d
parentActivate git plugin (diff)
Image preview improoveHEADmaster
-rwxr-xr-xrc.conf5
-rwxr-xr-xrifle.conf24
-rwxr-xr-xscope.sh11
3 files changed, 33 insertions, 7 deletions
diff --git a/rc.conf b/rc.conf
index d852824..39cca94 100755
--- a/rc.conf
+++ b/rc.conf
@@ -72,6 +72,7 @@ set preview_images true
# Preview images in full color using iTerm2 image previews
# (http://iterm2.com/images.html). This requires using iTerm2 compiled
# with image preview support.
+set preview_images_method kitty # does not work in tmux
set preview_images_method w3m
# Use a unicode "..." character to mark cut-off filenames?
@@ -327,7 +328,7 @@ map g/ cd /
map g? cd /usr/share/doc/ranger
# External Programs
-map E edit
+map e edit
map du shell -p du --max-depth=1 -h --apparent-size
map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
map yp shell -f echo -n %%d/%%f | xsel -i; xsel -o | xsel -i -b
@@ -545,7 +546,7 @@ copypmap <PAGEUP> p b <C-B>
pmap <C-l> redraw_window
pmap <ESC> pager_close
copypmap <ESC> q Q i <F3>
-pmap E edit_file
+pmap e edit_file
# ===================================================================
# == Taskview Keybindings
diff --git a/rifle.conf b/rifle.conf
index 9fae9e3..1514002 100755
--- a/rifle.conf
+++ b/rifle.conf
@@ -128,7 +128,6 @@ mime ^audio, has vlc, X, flag f = vlc --key-quit "Ctrl-v" --started-f
mime ^video, has vlc, X, flag f = cvlc --key-quit "Ctrl-v" --started-from-file -- "$@"
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
-mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
@@ -163,6 +162,12 @@ ext pdf, has atril, X, flag f = atril -- "$@"
ext pdf, has okular, X, flag f = okular -- "$@"
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
+
+ext epub, has foliate, X, flag f = foliate "$@"
+ext epub, has mupdf, X, flag f = mupdf "$@"
+ext epub, has zathura, X, flag f = zathura -- "$@"
+ext pdf, has okular, X, flag f = okular -- "$@"
+
ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
@@ -188,20 +193,27 @@ ext gif, has gifview, X, flag f = gifview -a -- "$@"
#-------------------------------------------
# Image Viewing:
#-------------------------------------------
+
+# SVG
mime ^image/svg, , , = $EDITOR -- "$@"
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image/svg, has display, X, flag f = display -- "$@"
+# Fallback
+mime ^image, has eog, X, flag f = eog -- "$@"
+mime ^image, has eom, X, flag f = eom -- "$@"
mime ^image, has ristretto, X, flag f = ristretto "$@"
+mime ^image, has mirage, X, flag f = mirage -- "$@"
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
mime ^image, has feh, X, flag f = feh -- "$@"
-mime ^image, has mirage, X, flag f = mirage -- "$@"
-mime ^image, has eog, X, flag f = eog -- "$@"
-mime ^image, has eom, X, flag f = eom -- "$@"
mime ^image, has gimp, X, flag f = gimp -- "$@"
ext xcf, X, flag f = gimp -- "$@"
+# WEBP
+mime ^image/webp, has gthumb, X, flag f = gthumb -- "$@"
+ext webp, has gthumb, X, flag f = gthumb -- "$@"
+
#-------------------------------------------
# Archives
@@ -212,6 +224,10 @@ ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als = als -- "$@" |
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack = aunpack -- "$@"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@"
+
+# 3D printing
+ext stl, has cura, X, flag f = cura -- "$@"
+
# Fallback:
ext tar|gz, has tar = tar vvtf "$@" | "$PAGER"
ext tar|gz, has tar = tar vvxf "$@"
diff --git a/scope.sh b/scope.sh
index c4cf37d..38578db 100755
--- a/scope.sh
+++ b/scope.sh
@@ -32,6 +32,7 @@ maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln
mimetype=$(file --mime-type -Lb "$path")
extension=$(/bin/echo "${path##*.}" | awk '{print tolower($0)}')
+
# Functions:
# runs a command and saves its output into $output. Useful if you need
# the return value AND want to use the output in a pipe
@@ -55,8 +56,14 @@ if [ "$preview_images" = "True" ]; then
# Image previews for image files. w3mimgdisplay will be called for all
# image files (unless overriden as above), but might fail for
# unsupported types.
+
+ application/epub+zip|application/x-mobipocket-ebook|\
+ application/x-fictionbook+xml)
+ gnome-epub-thumbnailer "$path" /tmp/thbn -s 600 && mv /tmp/thbn "$cached" && exit 6 || exit 1;;
application/pdf)
- pdftoppm -f 1 -singlefile -jpeg "$path" .thbn && mv .thbn.jpg "$cached" && exit 6 || exit 1;;
+ pdftoppm -f 1 -singlefile -jpeg "$path" /tmp/.thbn && mv /tmp/.thbn.jpg "$cached" && exit 6 || exit 1;;
+ image/avif)
+ convert "$path" "$cached" && exit 6 ||exit 1;;
image/svg+xml)
rsvg-convert "$path" -d 1 -p 2 > "$cached" && exit 6 ||exit 1;;
image/*)
@@ -85,6 +92,8 @@ case "$extension" in
pdf)
try pdftotext -l 10 -nopgbrk -q "$path" - && \
{ dump | trim | fmt -s -w $width; exit 0; } || exit 1;;
+ avif)
+ try convert "$path" "$cached" && exit 6 || exit 1;;
# BitTorrent Files
torrent)
try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;;