summaryrefslogtreecommitdiffstats
path: root/src/fs
diff options
context:
space:
mode:
authorDLFW <daniel@llin.info>2021-12-21 01:44:29 +0100
committerGitHub <noreply@github.com>2021-12-20 19:44:29 -0500
commit1d9986a2b3d3f849ac0288fb7135d3e938d72cf5 (patch)
treeeacbeda78933f31cc3401c87d491b0751e0cc6c6 /src/fs
parent51c567a620e64ed1876df87d7837ba66a4c3e27f (diff)
Add script hooks for image previews (#113)
This adds two configuration options, `preview_shown_hook_script` and `preview_removed_hook_script` in the preview-section where the user can configure external scripts which are called when a file preview is shown or when the file preview widget disappears, respectively. The `preview_shown_hook_script` gets the path of the file being previwed as first argument and then the x and y coordinate and the width an height of the preview area as second to fifth parameters. To get the geometry information back from the UI rendering process, a new struct `RenderResult` has been introduced which is given as mutable reference to the rendering function. The main-loop then checks for a changed preview and calls the hook scripts. Additionally, documentation has been added how these hooks can be used to implement image previews.
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/entry.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/fs/entry.rs b/src/fs/entry.rs
index 8d7b11d..fa30199 100644
--- a/src/fs/entry.rs
+++ b/src/fs/entry.rs
@@ -69,6 +69,10 @@ impl JoshutoDirEntry {
self.path.as_path()
}
+ pub fn file_path_buf(&self) -> path::PathBuf {
+ self.path.clone()
+ }
+
pub fn is_selected(&self) -> bool {
self.selected
}