summaryrefslogtreecommitdiffstats
path: root/src/app/app_context.rs
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2022-03-27 08:23:44 +0200
committerCanop <cano.petrole@gmail.com>2022-03-27 08:23:44 +0200
commit68ca143c0d8f5a8b871cafc7e283423a113f6959 (patch)
tree40a3284e25f63d3bc2801cbd4ca9d1b5eb53cbf8 /src/app/app_context.rs
parentf9fe6efebf3ce4e32d93705db8decc2019f7112f (diff)
add the (already documented) capture_mouse conf item
See https://github.com/Canop/broot/issues/238
Diffstat (limited to 'src/app/app_context.rs')
-rw-r--r--src/app/app_context.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/app/app_context.rs b/src/app/app_context.rs
index adb27ad..542b422 100644
--- a/src/app/app_context.rs
+++ b/src/app/app_context.rs
@@ -61,7 +61,8 @@ pub struct AppContext {
/// modal (aka "vim) mode enabled
pub modal: bool,
- pub mouse_capture_disabled: bool,
+ /// Whether to support mouse interactions
+ pub capture_mouse: bool,
/// max number of panels (including preview) that can be
/// open. Guaranteed to be at least 2.
@@ -110,6 +111,11 @@ impl AppContext {
let max_panels_count = config.max_panels_count
.unwrap_or(2)
.clamp(2, 100);
+ let capture_mouse = match (config.capture_mouse, config.disable_mouse_capture) {
+ (Some(b), _) => b, // the new "capture_mouse" argument takes precedence
+ (_, Some(b)) => !b,
+ _ => true,
+ };
Ok(Self {
config_paths,
launch_args,
@@ -123,7 +129,7 @@ impl AppContext {
true_colors,
icons,
modal: config.modal.unwrap_or(false),
- mouse_capture_disabled: config.disable_mouse_capture.unwrap_or(false),
+ capture_mouse,
max_panels_count,
quit_on_last_cancel: config.quit_on_last_cancel.unwrap_or(false),
file_sum_threads_count,