about summary refs log tree commit diff stats
path: root/modules/by-name
diff options
context:
space:
mode:
Diffstat (limited to 'modules/by-name')
-rw-r--r--modules/by-name/lf/lf/ctpv/default.nix8
-rw-r--r--modules/by-name/lf/lf/ctpv/prev/xcf.sh37
2 files changed, 45 insertions, 0 deletions
diff --git a/modules/by-name/lf/lf/ctpv/default.nix b/modules/by-name/lf/lf/ctpv/default.nix
index b47e03bd..f61b65f1 100644
--- a/modules/by-name/lf/lf/ctpv/default.nix
+++ b/modules/by-name/lf/lf/ctpv/default.nix
@@ -163,6 +163,14 @@ in
       ];
     };
 
+    xcf = {
+      priority = 1;
+      mime_matches = ["image/x-xcf"];
+      dependencies = [
+        # pkgs.gimp
+        pkgs.exiftool
+      ];
+    };
     svg = {
       priority = 1;
       mime_matches = ["image/svg+xml"];
diff --git a/modules/by-name/lf/lf/ctpv/prev/xcf.sh b/modules/by-name/lf/lf/ctpv/prev/xcf.sh
new file mode 100644
index 00000000..1603e337
--- /dev/null
+++ b/modules/by-name/lf/lf/ctpv/prev/xcf.sh
@@ -0,0 +1,37 @@
+#! /usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+
+# shellcheck disable=SC2269
+f="$f"
+# shellcheck disable=SC2269
+cache_f="$cache_f"
+
+. %HELPERS
+
+xcf() {
+    # TODO: Add this (currently it fails, as gimp lacks the `python-fu` evaluator) <2024-11-25>
+    true
+    #     # source: https://stackoverflow.com/a/20814599
+    #     # Start gimp with python-fu batch-interpreter
+    #     gimp -i --batch-interpreter=python-fu-eval -b - << EOF
+    #     import gimpfu
+    #
+    #     def convert(filename):
+    #         img = pdb.gimp_file_load(filename, filename)
+    #         new_name = "$cache_f"
+    #         layer = pdb.gimp_image_merge_visible_layers(img, 1)
+    #
+    #         pdb.gimp_file_save(img, layer, new_name, new_name)
+    #         pdb.gimp_image_delete(img)
+    #
+    #     convert('${f}')
+    #
+    #     pdb.gimp_quit(1)
+    # EOF
+}
+
+# convert_and_show_image xcf
+
+exiftool -- "$f"