|
| 1 | +# Image Thumbnails in File Previews |
| 2 | + |
| 3 | +Joshuto does not support image previews directly. |
| 4 | +One reason is that Joshuto wants to stay independent of specific display protocols and terminal emulators. |
| 5 | + |
| 6 | +However, Joshuto offers two preview-related hooks which allow to easily implement an |
| 7 | +image preview with some simple scripts. |
| 8 | +The hooks can be configured in the `joshuto.toml` file. |
| 9 | +```toml |
| 10 | +[preview] |
| 11 | +... |
| 12 | +preview_shown_hook_script = "~/path/to/some/executable_script_1" |
| 13 | +preview_removed_hook_script = "~/path/to/some/executable_script_2" |
| 14 | +``` |
| 15 | +The shown-hook is called whenever a new file-preview (in the 3rd pane) is activated. |
| 16 | + |
| 17 | +The removed-hook will be called each time the file preview panel |
| 18 | +completely disappears in Joshuto. |
| 19 | +That is the case if the user selects a file for which no file preview is shown |
| 20 | +(either due to missing output of the preview script or due to file size), |
| 21 | +if the preview is not cached already and the preview pane is temporarily removed, |
| 22 | +or if the selection jumps from a file to a directory. |
| 23 | + |
| 24 | +The “shown” script gets the path of the file being previewed |
| 25 | +as first argument and then the x and y coordinate and the width an |
| 26 | +height of the preview area as second to fifth parameters. |
| 27 | + |
| 28 | +The “removed” script does not get any arguments. |
| 29 | + |
| 30 | +Using these hook, one can trigger various actions when moving the cursor along files in Joshuto, |
| 31 | +and they can also be used to show image previews by the help of other 3rd party tools. |
| 32 | + |
| 33 | +Keep in mind that the result of the “normal” `preview` script you use for textual previews |
| 34 | +is cached by Joshuto and is not called every time a file is focused, but the “shown” hook is. |
| 35 | + |
| 36 | +# Wrapper Script |
| 37 | +For some of the 3rd party tools, it's necessary |
| 38 | +to run them as a separate process, in parallel to Joshuto. |
| 39 | + |
| 40 | +One famous example is “Überzug”. To be able to use such a solution, |
| 41 | +one need to have a “wrapper-script” which must be started instead of Joshuto. |
| 42 | +The wrapper-script will then start both, first the program for showing images |
| 43 | +in the terminal and then Joshuto. |
| 44 | + |
| 45 | + |
| 46 | +# Recipes |
| 47 | +## Image Thumbnail Solution Recipes |
| 48 | +We have recipes for a few famous solutions. |
| 49 | +* [Überzug](ueberzug.md) (only for X11) |
| 50 | +* [Überzug++](ueberzugpp.md) (for X11, some Wayland compositors, and some specific terminal emulators) |
| 51 | +* [Kitty](kitty.md) (for the Kitty terminal) |
| 52 | + |
| 53 | +## Other Recipes and Tricks |
| 54 | +* [Combining text preview and image preview](combined_with_text.md) |
| 55 | + |
| 56 | +# Recipe Contributions welcome 🤗 |
| 57 | + |
| 58 | +Feel free to provide recipes to include in this documentation. |
0 commit comments