about summary refs log tree commit diff
path: root/configs/configs_root_dir/home/xyz/.config/lf
diff options
context:
space:
mode:
Diffstat (limited to 'configs/configs_root_dir/home/xyz/.config/lf')
-rwxr-xr-xconfigs/configs_root_dir/home/xyz/.config/lf/previewer21
1 files changed, 21 insertions, 0 deletions
diff --git a/configs/configs_root_dir/home/xyz/.config/lf/previewer b/configs/configs_root_dir/home/xyz/.config/lf/previewer
new file mode 100755
index 0000000..8ef5d6a
--- /dev/null
+++ b/configs/configs_root_dir/home/xyz/.config/lf/previewer
@@ -0,0 +1,21 @@
+#!/bin/sh
+# not using it because security concerns, see: https://wiki.archlinux.org/title/Lf#Sandboxing_previews
+
+# references:
+# `man lf` PREVIEWING FILES section
+# maybe useful:
+# https://github.com/LukeSmithxyz/voidrice/tree/master/.config/lf
+# https://github.com/ranger/ranger/blob/master/ranger/data/scope.sh
+
+case "$1" in
+	# atool has more outputs like file mode bits but slower
+	#*.7z|*.zip|*.tar*) atool -l "$1";;
+	*.tar*) tar tf "$1";;
+	*.zip) unzip -l "$1";;
+	*.rar) unrar-free l "$1";;
+	*.7z) 7z l "$1";;
+	# pdftotext has better output than mutool
+	*.pdf) pdftotext "$1" -;;
+	#*.pdf) mutool draw -F txt "$1";;
+	*) highlight -O ansi -t4 "$1";;
+esac