aboutsummaryrefslogtreecommitdiff
path: root/config.dot
diff options
context:
space:
mode:
Diffstat (limited to 'config.dot')
-rwxr-xr-xconfig.dot/ranger/scope.sh.link19
1 files changed, 16 insertions, 3 deletions
diff --git a/config.dot/ranger/scope.sh.link b/config.dot/ranger/scope.sh.link
index 57aaa1d..989de8e 100755
--- a/config.dot/ranger/scope.sh.link
+++ b/config.dot/ranger/scope.sh.link
@@ -27,9 +27,16 @@ cached="$4" # Path that should be used to cache image previews
maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln
# Find out something about the file:
-mimetype=$(file --mime-type -Lb "$path")
+#mimetype=$(file --mime-type -Lb "$path")
extension=$(/bin/echo -E "${path##*.}" | tr "[:upper:]" "[:lower:]")
+# Workaround for firejail
+#mimetype=$(/usr/bin/file --mime-type -Lb "$path")
+#mimetype=$(file --mime-type -Lb "$path" | grep -v "^Redirecting symlink to")
+#mimetype=$(file --mime-type -Lb "$path" | sed -e 's/^.* //')
+#mimetype=$(file --mime-type -Lb "$path" | xargs)
+mimetype=$(firejail --quiet /usr/bin/file --mime-type -Lb "$path")
+
# 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
@@ -38,6 +45,12 @@ try() { output=$(eval '"$@"'); }
# writes the output of the previously used "try" command
dump() { /bin/echo -E "$output"; }
+# Use xmessage if you need to debug something
+#xmessage $*
+#xmessage $extension
+#xmessage $mimetype
+#exit
+
# a common post-processing function used after most commands
trim() { head -n "$maxln"; }
@@ -77,8 +90,8 @@ case "$mimetype" in
image/*)
img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;;
# Image preview for videos, disabled by default:
- #video/*)
- # ffmpegthumbnailer -i "$path" -o "$cached" -s 0 && exit 6 || exit 1;;
+ video/*)
+ ffmpegthumbnailer -i "$path" -o "$cached" -s 0 && exit 6 || exit 1;;
# Display information about media files:
video/* | audio/*)
exiftool "$path" && exit 5