From 63a6e01883793faf9072f12dfecc76b1ed46c8ef Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 19 Feb 2026 00:47:36 +0100 Subject: modules/lf/ctpv/prev: Add new previewers --- .../lf/ctpv/prev/application/archive/default.nix | 5 +++++ .../ctpv/prev/application/x-pem-file/default.nix | 4 +++- modules/by-name/lf/lf/ctpv/prev/font/default.nix | 1 + modules/by-name/lf/lf/ctpv/prev/inode/default.nix | 25 ---------------------- .../lf/lf/ctpv/prev/inode/directory/default.nix | 19 ++++++++++++++++ .../by-name/lf/lf/ctpv/prev/inode/directory/ls.sh | 20 +++++++++++++++++ .../by-name/lf/lf/ctpv/prev/inode/fifo/default.nix | 19 ++++++++++++++++ modules/by-name/lf/lf/ctpv/prev/inode/fifo/fifo.sh | 16 ++++++++++++++ modules/by-name/lf/lf/ctpv/prev/inode/ls.sh | 20 ----------------- modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh | 19 ---------------- .../lf/lf/ctpv/prev/inode/symlink/default.nix | 19 ++++++++++++++++ .../lf/lf/ctpv/prev/inode/symlink/symlink.sh | 19 ++++++++++++++++ .../lf/lf/ctpv/prev/inode/x-empty/default.nix | 19 ++++++++++++++++ .../by-name/lf/lf/ctpv/prev/inode/x-empty/empty.sh | 16 ++++++++++++++ .../lf/lf/ctpv/prev/message/rfc822/default.nix | 24 +++++++++++++++++++++ .../lf/lf/ctpv/prev/message/rfc822/rfc822.sh | 18 ++++++++++++++++ modules/by-name/lf/lf/ctpv/prev/text/default.nix | 3 +++ 17 files changed, 201 insertions(+), 65 deletions(-) delete mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/default.nix create mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/directory/default.nix create mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/directory/ls.sh create mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/fifo/default.nix create mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/fifo/fifo.sh delete mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/ls.sh delete mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh create mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/symlink/default.nix create mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/symlink/symlink.sh create mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/x-empty/default.nix create mode 100644 modules/by-name/lf/lf/ctpv/prev/inode/x-empty/empty.sh create mode 100644 modules/by-name/lf/lf/ctpv/prev/message/rfc822/default.nix create mode 100644 modules/by-name/lf/lf/ctpv/prev/message/rfc822/rfc822.sh (limited to 'modules') diff --git a/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix index aee5c732..d64c9572 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix @@ -14,14 +14,19 @@ matches.mime = [ "application/gzip" "application/java-archive" + "application/vnd.android.package-archive" "application/vnd.debian.binary-package" "application/x-7z-compressed" + "application/x-archive" "application/x-bzip2" + "application/x-cpio" + "application/x-lz4" "application/x-rar" "application/x-tar" "application/x-xz" "application/zip" "application/zlib" + "application/zstd" ]; matches.extension = [ diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix index fb82aa8a..28b69890 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix @@ -11,7 +11,9 @@ soispha.programs.lf.ctpv.previewers = { pem = { previewer = ./pem.sh; - matches.mime = ["application/x-pem-file"]; + matches.mime = [ + "application/x-pem-file" + ]; dependencies = [ pkgs.openssl ]; diff --git a/modules/by-name/lf/lf/ctpv/prev/font/default.nix b/modules/by-name/lf/lf/ctpv/prev/font/default.nix index 76a284f4..0f94603b 100644 --- a/modules/by-name/lf/lf/ctpv/prev/font/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/font/default.nix @@ -14,6 +14,7 @@ matches.mime = [ "font/*" "application/vnd.ms-opentype" + "application/x-font-pf2" # TODO: This should be added (ext: 'eot') <2024-12-04> # "application/vnd.ms-fontobject" diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/default.nix deleted file mode 100644 index fe5ee3e1..00000000 --- a/modules/by-name/lf/lf/ctpv/prev/inode/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{pkgs, ...}: { - soispha.programs.lf.ctpv.previewers = { - ls = { - previewer = ./ls.sh; - priority = 1; - matches.mime = ["inode/directory"]; - dependencies = [pkgs.coreutils]; - }; - symlink = { - previewer = ./symlink.sh; - priority = 1; - matches.mime = ["inode/symlink"]; - dependencies = []; - }; - }; -} diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/directory/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/directory/default.nix new file mode 100644 index 00000000..baf0314f --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/inode/directory/default.nix @@ -0,0 +1,19 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{pkgs, ...}: { + soispha.programs.lf.ctpv.previewers = { + ls = { + previewer = ./ls.sh; + priority = 1; + matches.mime = ["inode/directory"]; + dependencies = [pkgs.coreutils]; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/directory/ls.sh b/modules/by-name/lf/lf/ctpv/prev/inode/directory/ls.sh new file mode 100644 index 00000000..73e036eb --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/inode/directory/ls.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +cache_d="$cache_d" +# shellcheck disable=SC2269 +cache_f="$cache_f" + +ls --color --group-directories-first -- "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/fifo/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/fifo/default.nix new file mode 100644 index 00000000..70cb9132 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/inode/fifo/default.nix @@ -0,0 +1,19 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + soispha.programs.lf.ctpv.previewers = { + fifo = { + previewer = ./fifo.sh; + priority = 1; + matches.mime = ["inode/fifo"]; + dependencies = []; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/fifo/fifo.sh b/modules/by-name/lf/lf/ctpv/prev/inode/fifo/fifo.sh new file mode 100644 index 00000000..594d40db --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/inode/fifo/fifo.sh @@ -0,0 +1,16 @@ +#! /usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . + +# shellcheck disable=SC2269 +f="$f" + +printf "\n" diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh b/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh deleted file mode 100644 index 73e036eb..00000000 --- a/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh +++ /dev/null @@ -1,20 +0,0 @@ -#! /usr/bin/env dash - -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -cache_d="$cache_d" -# shellcheck disable=SC2269 -cache_f="$cache_f" - -ls --color --group-directories-first -- "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh b/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh deleted file mode 100644 index 2629f62a..00000000 --- a/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env dash - -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . - -# shellcheck disable=SC2269 -f="$f" - -# -# do nothing because in src/ctpv.c some kind of a "preview" -# is already printed -# diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/symlink/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/symlink/default.nix new file mode 100644 index 00000000..0c1cb286 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/inode/symlink/default.nix @@ -0,0 +1,19 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + soispha.programs.lf.ctpv.previewers = { + symlink = { + previewer = ./symlink.sh; + priority = 1; + matches.mime = ["inode/symlink"]; + dependencies = []; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/symlink/symlink.sh b/modules/by-name/lf/lf/ctpv/prev/inode/symlink/symlink.sh new file mode 100644 index 00000000..2629f62a --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/inode/symlink/symlink.sh @@ -0,0 +1,19 @@ +#! /usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . + +# shellcheck disable=SC2269 +f="$f" + +# +# do nothing because in src/ctpv.c some kind of a "preview" +# is already printed +# diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/default.nix new file mode 100644 index 00000000..670ad38b --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/default.nix @@ -0,0 +1,19 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + soispha.programs.lf.ctpv.previewers = { + empty = { + previewer = ./empty.sh; + priority = 1; + matches.mime = ["inode/x-empty"]; + dependencies = []; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/empty.sh b/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/empty.sh new file mode 100644 index 00000000..da2cd9a9 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/inode/x-empty/empty.sh @@ -0,0 +1,16 @@ +#! /usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . + +# shellcheck disable=SC2269 +f="$f" + +printf "\n" diff --git a/modules/by-name/lf/lf/ctpv/prev/message/rfc822/default.nix b/modules/by-name/lf/lf/ctpv/prev/message/rfc822/default.nix new file mode 100644 index 00000000..2e7e9628 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/message/rfc822/default.nix @@ -0,0 +1,24 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{pkgs, ...}: { + soispha.programs.lf.ctpv.previewers = { + rfc822 = { + previewer = ./rfc822.sh; + priority = 1; + matches.mime = [ + "message/rfc822" + "application/mbox" + ]; + dependencies = [ + pkgs.meli + ]; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/message/rfc822/rfc822.sh b/modules/by-name/lf/lf/ctpv/prev/message/rfc822/rfc822.sh new file mode 100644 index 00000000..d34cc48b --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/message/rfc822/rfc822.sh @@ -0,0 +1,18 @@ +#! /usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +cache_f="$cache_f" + +hide_script_env meli --config /dev/null view "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/text/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/default.nix index ca042646..868a7460 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/text/default.nix @@ -24,6 +24,9 @@ matches.mime = [ "text/*" "application/postscript" + "application/javascript" + "application/x-setupscript" + "application/x-wine-extension-ini" ]; dependencies = [ pkgs.bat -- cgit 1.4.1