ratatui_toolkit/master_layout/keybindings/mod.rs
1//! Configurable key bindings for MasterLayout
2
3mod constructors;
4mod methods;
5
6use crossterm::event::{KeyCode, KeyModifiers};
7
8/// Configurable key bindings for MasterLayout
9///
10/// This struct allows customization of all keyboard shortcuts used by MasterLayout.
11/// Each field represents a specific action and contains a tuple of (KeyCode, KeyModifiers).
12///
13/// # Example
14///
15/// ```
16/// use ratatui_toolkit::master_layout::MasterLayoutKeyBindings;
17/// use crossterm::event::{KeyCode, KeyModifiers};
18///
19/// let mut bindings = MasterLayoutKeyBindings::default();
20/// // Change quit key from 'q' to 'x'
21/// bindings.quit = vec![(KeyCode::Char('x'), KeyModifiers::empty())];
22/// ```
23#[derive(Debug, Clone)]
24pub struct MasterLayoutKeyBindings {
25 /// Keys to quit the application (default: q, Q)
26 pub quit: Vec<(KeyCode, KeyModifiers)>,
27 /// Key to clear selection in Layout Mode (default: Esc)
28 pub clear_selection: (KeyCode, KeyModifiers),
29 /// Key to deselect pane in Layout Mode (default: Ctrl+A)
30 pub deselect_pane: (KeyCode, KeyModifiers),
31 /// Keys to switch tabs (default: 1-9)
32 pub switch_tabs: Vec<(KeyCode, KeyModifiers)>,
33 /// Key to navigate left (default: h)
34 pub navigate_left: (KeyCode, KeyModifiers),
35 /// Key to navigate right (default: l)
36 pub navigate_right: (KeyCode, KeyModifiers),
37 /// Key to navigate up (default: k)
38 pub navigate_up: (KeyCode, KeyModifiers),
39 /// Key to navigate down (default: j)
40 pub navigate_down: (KeyCode, KeyModifiers),
41 /// Key to focus the selected pane (default: Enter)
42 pub focus_pane: (KeyCode, KeyModifiers),
43 /// Key to exit focus mode (default: Ctrl+A)
44 pub exit_focus_mode: (KeyCode, KeyModifiers),
45 /// Key to copy selection (default: Ctrl+Shift+C)
46 pub copy_selection: (KeyCode, KeyModifiers),
47}