diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-14 02:50:00 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-14 02:50:00 +0300 |
| commit | ed4253d6031c9a3b12ddd6dfc7d7bf39480ae761 (patch) | |
| tree | 315cea3ee7b5ad3a7c3f9fb31272064a0eed5dd2 /src/app/state.rs | |
| parent | 287bf51640f8e1bed227cb27d93377d962851196 (diff) | |
feat: add tmux-style mouse capture config
Diffstat (limited to 'src/app/state.rs')
| -rw-r--r-- | src/app/state.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/app/state.rs b/src/app/state.rs index c79fbc24..155851d7 100644 --- a/src/app/state.rs +++ b/src/app/state.rs @@ -709,6 +709,9 @@ pub struct AppState { /// Ratio of sidebar height allocated to the workspaces section. pub sidebar_section_split: f32, pub agent_panel_scope: AgentPanelScope, + /// Capture mouse input for Herdr's own mouse UI. When false, Herdr only + /// captures mouse while the focused pane app requests mouse reporting. + pub mouse_capture: bool, pub confirm_close: bool, pub show_agent_labels_on_pane_borders: bool, pub kitty_graphics_enabled: bool, @@ -752,6 +755,20 @@ impl AppState { self.show_agent_labels_on_pane_borders } + pub fn focused_pane_requests_mouse_capture(&self) -> bool { + self.mode == Mode::Terminal + && self + .active + .and_then(|idx| self.workspaces.get(idx)) + .and_then(crate::workspace::Workspace::focused_runtime) + .and_then(crate::pane::PaneRuntime::input_state) + .is_some_and(crate::pane::InputState::mouse_reporting_enabled) + } + + pub fn should_capture_host_mouse(&self) -> bool { + self.mouse_capture || self.focused_pane_requests_mouse_capture() + } + pub fn is_prefix(&self, key: &crossterm::event::KeyEvent) -> bool { key_matches(key, self.prefix_code, self.prefix_mods) } @@ -877,6 +894,7 @@ impl AppState { sidebar_collapsed: false, sidebar_section_split: 0.5, agent_panel_scope: AgentPanelScope::AllWorkspaces, + mouse_capture: true, confirm_close: true, show_agent_labels_on_pane_borders: false, kitty_graphics_enabled: false, |
