Compare commits

...

2 Commits

Author SHA1 Message Date
nyx
4545c2d8e8
Merge 63da751e59 into 2dabb934f7 2024-11-15 17:22:42 -08:00
nnyyxxxx
63da751e59
add a toggle for mouse interaction 2024-11-12 05:35:53 -05:00

View File

@ -66,6 +66,7 @@ pub struct AppState {
tip: String, tip: String,
size_bypass: bool, size_bypass: bool,
skip_confirmation: bool, skip_confirmation: bool,
mouse_enabled: bool,
} }
pub enum Focus { pub enum Focus {
@ -123,6 +124,7 @@ impl AppState {
tip: get_random_tip(), tip: get_random_tip(),
size_bypass, size_bypass,
skip_confirmation, skip_confirmation,
mouse_enabled: false,
}; };
#[cfg(unix)] #[cfg(unix)]
@ -206,6 +208,7 @@ impl AppState {
hints.push(Shortcut::new("Next tab", ["Tab"])); hints.push(Shortcut::new("Next tab", ["Tab"]));
hints.push(Shortcut::new("Previous tab", ["Shift-Tab"])); hints.push(Shortcut::new("Previous tab", ["Shift-Tab"]));
hints.push(Shortcut::new("Important actions guide", ["g"])); hints.push(Shortcut::new("Important actions guide", ["g"]));
hints.push(Shortcut::new("Toggle mouse", ["m"]));
("Command list", hints.into_boxed_slice()) ("Command list", hints.into_boxed_slice())
} }
@ -489,7 +492,7 @@ impl AppState {
} }
pub fn handle_mouse(&mut self, event: &MouseEvent) -> bool { pub fn handle_mouse(&mut self, event: &MouseEvent) -> bool {
if !self.drawable { if !self.drawable || !self.mouse_enabled {
return true; return true;
} }
@ -651,6 +654,7 @@ impl AppState {
KeyCode::Char('g') => self.toggle_task_list_guide(), KeyCode::Char('g') => self.toggle_task_list_guide(),
KeyCode::Char('v') | KeyCode::Char('V') => self.toggle_multi_select(), KeyCode::Char('v') | KeyCode::Char('V') => self.toggle_multi_select(),
KeyCode::Char(' ') if self.multi_select => self.toggle_selection(), KeyCode::Char(' ') if self.multi_select => self.toggle_selection(),
KeyCode::Char('m') => self.mouse_enabled = !self.mouse_enabled,
_ => {} _ => {}
}, },