about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--doc/ranger.13
-rw-r--r--doc/ranger.pod5
-rwxr-xr-xranger/data/scope.sh30
4 files changed, 27 insertions, 13 deletions
diff --git a/README.md b/README.md
index 10bdcfb5..d7fe30b3 100644
--- a/README.md
+++ b/README.md
@@ -108,6 +108,8 @@ For enhanced file previews (with `scope.sh`):
 * `python` or `jq` for JSON files
 * `fontimage` for font previews
 * `openscad` for 3D model previews (`stl`, `off`, `dxf`, `scad`, `csg`)
+* `draw.io` for [draw.io](https://app.diagrams.net/) diagram previews
+  (`drawio` extension)
 
 Installing
 ----------
diff --git a/doc/ranger.1 b/doc/ranger.1
index 377930ed..cc166604 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -341,6 +341,9 @@ preview as image
 \&\f(CW\*(C`fontimage\*(C'\fR for font previews
 .IP "\-" 2
 \&\f(CW\*(C`openscad\*(C'\fR for 3D model previews (stl, off, dxf, scad, csg)
+.IP "\-" 2
+\&\f(CW\*(C`draw.io\*(C'\fR for draw.io <https://app.diagrams.net/> diagram previews (drawio
+extension)
 .RE
 .RS 2
 .RE
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 5980f16f..f3413856 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -298,6 +298,11 @@ C<fontimage> for font previews
 
 C<openscad> for 3D model previews (stl, off, dxf, scad, csg)
 
+=item -
+
+C<draw.io> for draw.io L<https://app.diagrams.net/> diagram previews (drawio
+extension)
+
 =back
 
 =back
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index 864e39ab..5e0e66ac 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -262,19 +262,23 @@ handle_image() {
     #     mv "${TMPPNG}" "${IMAGE_CACHE_PATH}"
     # }
 
-    # case "${FILE_EXTENSION_LOWER}" in
-    #     ## 3D models
-    #     ## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH}
-    #     ## is hardcoded as jpeg. So we make a tempfile.png and just
-    #     ## move/rename it to jpg. This works because image libraries are
-    #     ## smart enough to handle it.
-    #     csg|scad)
-    #         openscad_image "${FILE_PATH}" && exit 6
-    #         ;;
-    #     3mf|amf|dxf|off|stl)
-    #         openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6
-    #         ;;
-    # esac
+    case "${FILE_EXTENSION_LOWER}" in
+       ## 3D models
+       ## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH}
+       ## is hardcoded as jpeg. So we make a tempfile.png and just
+       ## move/rename it to jpg. This works because image libraries are
+       ## smart enough to handle it.
+       # csg|scad)
+       #     openscad_image "${FILE_PATH}" && exit 6
+       #     ;;
+       # 3mf|amf|dxf|off|stl)
+       #     openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6
+       #     ;;
+       drawio)
+           draw.io -x "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" \
+               --width "${DEFAULT_SIZE%x*}" && exit 6
+           exit 1;;
+    esac
 }
 
 handle_mime() {