summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2022-01-09 21:03:08 -0500
committerJeff Zhao <jeff.no.zhao@gmail.com>2022-01-09 21:03:53 -0500
commitfd06ae874291679b7ca0a1e8ac3611106b410840 (patch)
tree524e4166d8c2bdba5cf0027631b4c6eb3c503afe
parent61dc86ffb00ee705bdd4bacefe375d5ff28d6517 (diff)
add option to turn off automatic directory reloading
-rw-r--r--config/joshuto.toml1
-rw-r--r--docs/configuration/joshuto.toml.md4
-rw-r--r--src/config/general/app.rs1
-rw-r--r--src/config/general/app_crude.rs3
-rw-r--r--src/run.rs4
5 files changed, 11 insertions, 2 deletions
diff --git a/config/joshuto.toml b/config/joshuto.toml
index 22a18bb..cda9bcd 100644
--- a/config/joshuto.toml
+++ b/config/joshuto.toml
@@ -1,5 +1,6 @@
xdg_open = false
use_trash = true
+watch_files = true
[display]
automatically_count_files = false
diff --git a/docs/configuration/joshuto.toml.md b/docs/configuration/joshuto.toml.md
index a1171be..f1c5d95 100644
--- a/docs/configuration/joshuto.toml.md
+++ b/docs/configuration/joshuto.toml.md
@@ -12,8 +12,10 @@ xdg_open = false
# Use system trash can instead of permanently removing files
use_trash = true
+# Watch for filesystem changes and update directory listings accordingly
+watch_files = true
+
# The maximum file size to show a preview for
-# CURRENTLY DOES NOT WORK
max_preview_size = 2097152 # 2MB
# Configurations related to the display
diff --git a/src/config/general/app.rs b/src/config/general/app.rs
index a55ccbe..a7602d4 100644
--- a/src/config/general/app.rs
+++ b/src/config/general/app.rs
@@ -8,6 +8,7 @@ use crate::error::JoshutoResult;
pub struct AppConfig {
pub use_trash: bool,
pub xdg_open: bool,
+ pub watch_files: bool,
pub _display_options: DisplayOption,
pub _preview_options: PreviewOption,
pub _tab_options: TabOption,
diff --git a/src/config/general/app_crude.rs b/src/config/general/app_crude.rs
index d24eff9..20add72 100644
--- a/src/config/general/app_crude.rs
+++ b/src/config/general/app_crude.rs
@@ -24,6 +24,8 @@ pub struct AppConfigCrude {
pub use_trash: bool,
#[serde(default)]
pub xdg_open: bool,
+ #[serde(default = "default_true")]
+ pub watch_files: bool,
#[serde(default, rename = "display")]
pub display_options: DisplayOptionCrude,
#[serde(default, rename = "preview")]
@@ -37,6 +39,7 @@ impl From<AppConfigCrude> for AppConfig {
Self {
use_trash: crude.use_trash,
xdg_open: crude.xdg_open,
+ watch_files: crude.watch_files,
_display_options: DisplayOption::from(crude.display_options),
_preview_options: PreviewOption::from(crude.preview_options),
_tab_options: TabOption::from(crude.tab_options),
diff --git a/src/run.rs b/src/run.rs
index 63fa7d0..2430e3b 100644
--- a/src/run.rs
+++ b/src/run.rs
@@ -109,7 +109,9 @@ pub fn run(
}
// update the file system supervisor that watches for changes in the FS
- context.update_watcher();
+ if context.config_ref().watch_files {
+ context.update_watcher();
+ }
} // end of main loop
Ok(())
}