summaryrefslogtreecommitdiffstats
path: root/src
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 /src
parent61dc86ffb00ee705bdd4bacefe375d5ff28d6517 (diff)
add option to turn off automatic directory reloading
Diffstat (limited to 'src')
-rw-r--r--src/config/general/app.rs1
-rw-r--r--src/config/general/app_crude.rs3
-rw-r--r--src/run.rs4
3 files changed, 7 insertions, 1 deletions
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(())
}