From fed90585a6fcdacc75f338f57157ab25100a83ad Mon Sep 17 00:00:00 2001 From: lanxu Date: Sat, 3 Feb 2018 20:26:11 +0200 Subject: [PATCH] Disabled ranger scope for files larger than 10 megabytes --- .config/ranger/scope.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.config/ranger/scope.sh b/.config/ranger/scope.sh index 55a01d8..90bb421 100755 --- a/.config/ranger/scope.sh +++ b/.config/ranger/scope.sh @@ -160,14 +160,18 @@ handle_fallback() { exit 1 } +size=$(stat -c%s "${FILE_PATH}") # file size in bytes -handle_extension -#MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )" -MIMETYPE="$(xdg-mime query filetype "${FILE_PATH}" )" -if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then +if [ $size -le 10485760 ]; then + handle_extension + #MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )" + MIMETYPE="$(xdg-mime query filetype "${FILE_PATH}" )" + if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then handle_image "${MIMETYPE}" + fi + handle_mime "${MIMETYPE}" fi -handle_mime "${MIMETYPE}" + handle_fallback exit 1