diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-11-25 16:55:31 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-11-25 16:55:31 +0100 |
commit | e55597aa6a3115b148685b56478b95a24acd8927 (patch) | |
tree | 472e9b11d58b4d35a6444996f5b5b599bacb310e /modules/by-name | |
parent | fix(modules/lf/ctpv/helpers): Turn of `chafa`'s animations (diff) | |
download | nixos-config-e55597aa6a3115b148685b56478b95a24acd8927.tar.gz nixos-config-e55597aa6a3115b148685b56478b95a24acd8927.zip |
fix(modules/lf/ctpv): Don't try to preview `.xcf` images
Diffstat (limited to 'modules/by-name')
-rw-r--r-- | modules/by-name/lf/lf/ctpv/default.nix | 8 | ||||
-rw-r--r-- | modules/by-name/lf/lf/ctpv/prev/xcf.sh | 37 |
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" |