2022-06-14 13:00:53 +02:00
|
|
|
# ctpv
|
|
|
|
|
|
|
|
Terminal previewer
|
|
|
|
|
|
|
|
![showcase](doc/showcase.gif)
|
|
|
|
|
|
|
|
----
|
|
|
|
|
2022-07-11 15:40:12 +02:00
|
|
|
ctpv is a previewer utility for terminals.
|
2022-06-20 22:25:31 +02:00
|
|
|
|
2022-07-11 15:40:12 +02:00
|
|
|
It supports previews for source code, archives, PDF files, images
|
|
|
|
and videos (see [Previews](#previews)).
|
|
|
|
|
|
|
|
Image previews are powered by one of these:
|
2022-06-20 22:25:31 +02:00
|
|
|
|
2022-09-15 20:03:58 +02:00
|
|
|
* [Überzug](https://github.com/seebye/ueberzug) (X11 only)
|
2022-06-26 14:27:17 +02:00
|
|
|
* [Kitty terminal](https://github.com/kovidgoyal/kitty)
|
|
|
|
* [Chafa](https://github.com/hpjansson/chafa)
|
2022-06-14 13:00:53 +02:00
|
|
|
|
2022-06-16 07:00:57 +02:00
|
|
|
ctpv is a remake of an awesome program named
|
2022-09-10 16:30:16 +02:00
|
|
|
[stpv](https://github.com/Naheel-Azawy/stpv)
|
|
|
|
written in C.
|
2022-06-14 13:00:53 +02:00
|
|
|
stpv worked perfectly for me, except it was kinda sluggish because
|
|
|
|
it was written in POSIX shell.
|
2022-06-16 07:00:57 +02:00
|
|
|
ctpv is an attempt to make a faster version of stpv and add some
|
|
|
|
new features.
|
2022-06-14 13:00:53 +02:00
|
|
|
|
2022-09-11 21:06:32 +02:00
|
|
|
Originally it was made for [lf]
|
2022-06-16 07:00:57 +02:00
|
|
|
file manager but I believe that it can be easily integrated into
|
2022-07-11 15:40:12 +02:00
|
|
|
other programs as well
|
|
|
|
(either via configuration file like in lf or a simple wrapper
|
|
|
|
script).
|
2022-06-14 13:00:53 +02:00
|
|
|
|
2022-06-17 10:41:43 +02:00
|
|
|
## Dependencies
|
|
|
|
|
2022-06-21 17:09:07 +02:00
|
|
|
### Libraries
|
|
|
|
|
|
|
|
* `libcrypto`
|
|
|
|
* `libmagic`
|
|
|
|
|
|
|
|
### Previews
|
|
|
|
|
2022-06-19 17:21:52 +02:00
|
|
|
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.
|
2022-06-17 10:41:43 +02:00
|
|
|
|
2022-06-18 17:50:57 +02:00
|
|
|
<!-- This table is auto generated! -->
|
|
|
|
<!--TABLESTART-->
|
|
|
|
| File types | Programs |
|
2022-06-17 10:53:10 +02:00
|
|
|
| ---- | ---- |
|
2022-06-18 17:50:57 +02:00
|
|
|
| any | `exiftool` `cat` |
|
|
|
|
| archive | `atool` |
|
|
|
|
| diff | `colordiff` `delta` `diff-so-fancy` |
|
|
|
|
| directory | `ls` |
|
2022-07-27 15:00:16 +02:00
|
|
|
| font | `fontimage` |
|
2022-07-13 11:59:22 +02:00
|
|
|
| gpg-encrypted | `gpg` |
|
2022-06-18 17:50:57 +02:00
|
|
|
| html | `elinks` `lynx` `w3m` |
|
2022-06-23 13:54:23 +02:00
|
|
|
| image | `ueberzug` `chafa` |
|
2022-06-18 17:50:57 +02:00
|
|
|
| json | `jq` |
|
|
|
|
| markdown | `mdcat` |
|
2022-07-31 14:16:08 +02:00
|
|
|
| office | `libreoffice` |
|
2022-06-18 17:50:57 +02:00
|
|
|
| pdf | `pdftoppm` |
|
|
|
|
| text | `bat` `cat` `highlight` `source-highlight` |
|
|
|
|
| torrent | `transmission-show` |
|
|
|
|
| video | `ffmpegthumbnailer` |
|
|
|
|
|
|
|
|
<!--TABLEEND-->
|
2022-06-17 10:41:43 +02:00
|
|
|
|
2022-06-14 13:00:53 +02:00
|
|
|
## Installation
|
|
|
|
|
|
|
|
### Manual
|
|
|
|
|
|
|
|
```sh
|
|
|
|
git clone https://github.com/NikitaIvanovV/ctpv
|
|
|
|
cd ctpv
|
|
|
|
sudo make install
|
|
|
|
```
|
|
|
|
|
|
|
|
Uninstall with `sudo make uninstall`
|
|
|
|
|
2022-06-21 17:07:01 +02:00
|
|
|
### AUR
|
|
|
|
|
|
|
|
If you are an Arch Linux user, you can install
|
2022-09-10 16:30:16 +02:00
|
|
|
[`ctpv-git`](https://aur.archlinux.org/packages/ctpv-git)
|
|
|
|
AUR package.
|
2022-06-21 17:07:01 +02:00
|
|
|
|
|
|
|
```sh
|
|
|
|
yay -S ctpv-git
|
|
|
|
```
|
|
|
|
|
2022-06-14 13:00:53 +02:00
|
|
|
## Integration
|
|
|
|
|
|
|
|
### lf file manager
|
|
|
|
|
|
|
|
Add these lines to your lf config
|
2022-07-14 11:45:45 +02:00
|
|
|
(usually located at `~/.config/lf/lfrc`).
|
|
|
|
|
2022-06-14 13:00:53 +02:00
|
|
|
```
|
|
|
|
set previewer ctpv
|
|
|
|
set cleaner ctpvclear
|
|
|
|
&ctpv -s $id
|
2022-08-02 00:04:51 +02:00
|
|
|
&ctpvquit $id
|
2022-06-14 13:00:53 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Documentation
|
|
|
|
|
2022-06-20 22:25:31 +02:00
|
|
|
Full documentation on command line options,
|
2022-09-10 16:30:16 +02:00
|
|
|
configuration and how to define custom previews can be found here:
|
|
|
|
https://nikitaivanovv.github.io/ctpv/
|
2022-07-14 11:45:45 +02:00
|
|
|
|
|
|
|
[lf]: https://github.com/gokcehan/lf
|