From d16d20a4f5cd2d902830728f06cc6b81724d3c12 Mon Sep 17 00:00:00 2001 From: octvs Date: Thu, 1 May 2025 13:32:56 +0200 Subject: [PATCH] ctpv: fix img previews and correct dependency Add missing pdf preview dependency. `ctpv` uses `pdftoppm` [1] to preview pdf files. Required dependency was not included on the last PR targeting `ctpv`, although it added the tools for other ftypes [2]. Fix chafa image privews by passing the missing flag via a patch. This comes from a year long bug fix PR open at upstream, for details refer there [3]. [1]: https://github.com/NikitaIvanovV/ctpv/blob/4efa0f976eaf8cb814e0aba4f4f1a1d12ee9262e/README.md#L58 [2]: github:NixOS/nixpkgs#223487 [3]: github:NikitaIvanovV/ctpv#90 --- pkgs/by-name/ct/ctpv/package.nix | 5 +++++ pkgs/by-name/ct/ctpv/use-polite-flag.patch | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/by-name/ct/ctpv/use-polite-flag.patch diff --git a/pkgs/by-name/ct/ctpv/package.nix b/pkgs/by-name/ct/ctpv/package.nix index aeac6bdee939..b0911c51be42 100644 --- a/pkgs/by-name/ct/ctpv/package.nix +++ b/pkgs/by-name/ct/ctpv/package.nix @@ -15,6 +15,7 @@ glow, imagemagick, jq, + poppler-utils, ueberzug, }: @@ -52,11 +53,15 @@ stdenv.mkDerivation rec { glow # for markdown files imagemagick jq # for json files + poppler-utils # for pdf files ueberzug # for image files on X11 ] }"; ''; + # Until https://github.com/NikitaIvanovV/ctpv/pull/90 is merged + patches = [ ./use-polite-flag.patch ]; + meta = with lib; { description = "File previewer for a terminal"; homepage = "https://github.com/NikitaIvanovV/ctpv"; diff --git a/pkgs/by-name/ct/ctpv/use-polite-flag.patch b/pkgs/by-name/ct/ctpv/use-polite-flag.patch new file mode 100644 index 000000000000..9cd37a5267f0 --- /dev/null +++ b/pkgs/by-name/ct/ctpv/use-polite-flag.patch @@ -0,0 +1,13 @@ +diff --git a/sh/helpers.sh b/sh/helpers.sh +index fef8691..229d38f 100644 +--- a/sh/helpers.sh ++++ b/sh/helpers.sh +@@ -73,7 +73,7 @@ is_anim_image() { + chafa_run() { + format='-f symbols' + autochafa && format= +- chafasixel && format='-f sixels' ++ chafasixel && format='-f sixels --polite on' + chafa -s "${w}x${h}" $format "$1" | sed 's/#/\n#/g' + } +