Image previews for lf file manager
Go to file
Nikita Ivanov 2a890bdeae
Fix
2022-07-28 03:16:30 +05:00
deptable Refactor deplist 2022-07-26 00:01:08 +05:00
doc Add fonts support 2022-07-27 18:00:16 +05:00
embed Minor 2022-05-24 01:03:13 +05:00
sh Fix 2022-07-28 03:16:30 +05:00
src Add default values for w, h, x and y 2022-07-26 01:01:35 +05:00
.gitignore Initial commit 2022-05-22 12:56:26 +05:00
ctpvclear ctpvclear: add option to pass id as argument 2022-05-29 21:40:11 +05:00
LICENSE Initial commit 2022-05-22 12:56:26 +05:00
Makefile Refactor deplist 2022-07-26 00:01:08 +05:00
previews.h Add more document formats 2022-07-28 03:02:07 +05:00
README.md Add fonts support 2022-07-27 18:00:16 +05:00
version.h Add version 2022-07-26 00:38:46 +05:00

ctpv

Terminal previewer

showcase


ctpv is a previewer utility for terminals.

It supports previews for source code, archives, PDF files, images and videos (see Previews).

Image previews are powered by one of these:

ctpv is a remake of an awesome program named stpv written in C. stpv worked perfectly for me, except it was kinda sluggish because it was written in POSIX shell. ctpv is an attempt to make a faster version of stpv and add some new features.

Originally it was made for lf file manager but I believe that it can be easily integrated into other programs as well (either via configuration file like in lf or a simple wrapper script).

Dependencies

Libraries

  • libcrypto
  • libmagic

Previews

Previewing each file type requires specific programs. If a program is not found on the system, ctpv will try to use another one. Only one program is required for each file type. For example, you only need either elinks, lynx or w3m installed on your system to view HTML files.

File types Programs
any exiftool cat
archive atool
diff colordiff delta diff-so-fancy
directory ls
font fontimage
gpg-encrypted gpg
html elinks lynx w3m
image ueberzug chafa
json jq
markdown mdcat
odt libreoffice
pdf pdftoppm
text bat cat highlight source-highlight
torrent transmission-show
video ffmpegthumbnailer

Installation

Manual

git clone https://github.com/NikitaIvanovV/ctpv
cd ctpv
sudo make install

Uninstall with sudo make uninstall

AUR

If you are an Arch Linux user, you can install ctpv-git AUR package.

yay -S ctpv-git

Integration

lf file manager

Add these lines to your lf config (usually located at ~/.config/lf/lfrc).

Note: on-quit command is not a part of lf r27 release yet, so I strongly suggest you to install the latest version from the GitHub page (or lf-git AUR package if you use Arch Linux).

set previewer ctpv
set cleaner ctpvclear
&ctpv -s $id
cmd on-quit $ctpv -e $id

Documentation

Full documentation on command line options, configuration and how to define custom previews can be found here: https://nikitaivanovv.github.io/ctpv/