From 087a3cef9ac8a4eb33ae94592e1962e6d75d221e Mon Sep 17 00:00:00 2001 From: ProspectPyxis Date: Thu, 12 Jan 2023 13:36:08 +0700 Subject: [PATCH] feat: hide_mouse_cursor_when_typing config option --- config/src/config.rs | 5 +++++ wezterm-gui/src/termwindow/keyevent.rs | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config/src/config.rs b/config/src/config.rs index 9a2be00f7..d99190706 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -581,6 +581,11 @@ pub struct Config { #[dynamic(default = "linear_ease")] pub text_blink_rapid_ease_out: EasingFunction, + /// If true, the mouse cursor will be hidden while typing. + /// This option is true by default. + #[dynamic(default = "default_true")] + pub hide_mouse_cursor_when_typing: bool, + /// If non-zero, specifies the period (in seconds) at which various /// statistics are logged. Note that there is a minimum period of /// 10 seconds. diff --git a/wezterm-gui/src/termwindow/keyevent.rs b/wezterm-gui/src/termwindow/keyevent.rs index c17f3e9d4..334fb35ac 100644 --- a/wezterm-gui/src/termwindow/keyevent.rs +++ b/wezterm-gui/src/termwindow/keyevent.rs @@ -391,7 +391,9 @@ impl super::TermWindow { { self.maybe_scroll_to_bottom_for_input(&pane); } - context.set_cursor(None); + if self.config.hide_mouse_cursor_when_typing { + context.set_cursor(None); + } if !keycode.is_modifier() { context.invalidate(); } @@ -646,7 +648,9 @@ impl super::TermWindow { { self.maybe_scroll_to_bottom_for_input(&pane); } - context.set_cursor(None); + if self.config.hide_mouse_cursor_when_typing { + context.set_cursor(None); + } if !key.is_modifier() { context.invalidate(); }