Image previews for lf file manager
Go to file
2023-03-26 23:13:03 +02:00
deptable Minor 2022-09-09 22:34:28 +05:00
doc Add -h option 2023-03-26 03:05:05 +02:00
embed Minor 2022-09-02 01:46:02 +05:00
quit Minor 2022-08-02 22:17:56 +05:00
sh Add chafasixel option 2023-03-21 19:05:03 +01:00
src Add -h option 2023-03-26 03:05:05 +02:00
.gitignore Minor: add quit/ctpvquit to .gitignore 2022-08-02 17:52:44 +05:00
ctpvclear ctpvclear: add option to pass id as argument 2022-05-29 21:40:11 +05:00
genhelp.sh Add -h option 2023-03-26 03:05:05 +02:00
help.txt Add -h option 2023-03-26 03:05:05 +02:00
LICENSE Initial commit 2022-05-22 12:56:26 +05:00
Makefile Add -h option 2023-03-26 03:05:05 +02:00
previews.h Update docs 2023-03-20 20:00:17 +01:00
README.md Update docs 2023-03-26 00:41:45 +01:00
version.h Version bump 2023-03-26 23:13:03 +02:00

ctpv

File previewer for a terminal

showcase


ctpv is a file previewer utility for a terminal.

It was made with integration into lf file manager in mind, but I believe that it can be easily integrated into other programs as well.

It supports previews for source code, archives, PDF files, images, videos, etc. See Previews for more info.

Image previews are powered by one of these programs:

ctpv is a remake of an awesome program named stpv. stpv did everything I wanted, except it was a bit sluggish because it was written in POSIX shell. ctpv is written in C and is an attempt to make a faster version of stpv with a few new features.

Previews

Previewing each file type requires specific programs installed on a system. 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
audio ffmpegthumbnailer ffmpeg
diff colordiff delta diff-so-fancy
directory ls
font fontimage
gpg-encrypted gpg
html elinks lynx w3m
image ueberzug chafa
json jq
markdown glow mdcat
office libreoffice
pdf pdftoppm
svg convert
text bat cat highlight source-highlight
torrent transmission-show
video ffmpegthumbnailer

Installation

Manual

If you are building from source, make sure to install these libraries! Depending on your system, you probably will also need "devel" versions of the same libraries.

  • libcrypto
  • libmagic

Install:

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

Uninstall:

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).

set previewer ctpv
set cleaner ctpvclear
&ctpv -s $id
&ctpvquit $id

Wayland

If you use Wayland, follow these steps:

As of 2023-03-19, original lf does not support sixel protocol, which is why you need use the fork.

Documentation

Full documentation on command line options, configuration and how to define custom previews can be found here: https://www.nikitaivanov.com/man1/ctpv