Skip to main content

par_term_config/config/config_struct/
pane_config.rs

1//! Split-pane layout and appearance settings.
2//!
3//! Extracted from the top-level [`super::Config`] struct via `#[serde(flatten)]`.
4//! All fields serialise at the top level of the YAML config file -- existing
5//! config files remain 100% compatible.
6
7use crate::types::{DividerStyle, PaneTitlePosition};
8use serde::{Deserialize, Serialize};
9
10/// Split-pane divider, padding, title-bar and focus-indicator settings.
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct PaneConfig {
13    /// Width of dividers between panes in pixels (visual width)
14    #[serde(default = "crate::defaults::pane_divider_width")]
15    pub pane_divider_width: Option<f32>,
16
17    /// Width of the drag hit area for resizing panes (should be >= divider width)
18    /// A larger hit area makes it easier to grab the divider for resizing
19    #[serde(default = "crate::defaults::pane_divider_hit_width")]
20    pub pane_divider_hit_width: f32,
21
22    /// Padding inside panes in pixels (space between content and border/divider)
23    #[serde(default = "crate::defaults::pane_padding")]
24    pub pane_padding: f32,
25
26    /// Minimum pane size in cells (columns for horizontal splits, rows for vertical)
27    /// Prevents panes from being resized too small to be useful
28    #[serde(default = "crate::defaults::pane_min_size")]
29    pub pane_min_size: usize,
30
31    /// Pane background opacity (0.0 = fully transparent, 1.0 = fully opaque)
32    /// Lower values allow background image/shader to show through pane backgrounds
33    #[serde(default = "crate::defaults::pane_background_opacity")]
34    pub pane_background_opacity: f32,
35
36    /// Pane divider color [R, G, B] (0-255)
37    #[serde(default = "crate::defaults::pane_divider_color")]
38    pub pane_divider_color: [u8; 3],
39
40    /// Pane divider hover color [R, G, B] (0-255) - shown when mouse hovers over divider
41    #[serde(default = "crate::defaults::pane_divider_hover_color")]
42    pub pane_divider_hover_color: [u8; 3],
43
44    /// Enable visual dimming of inactive panes
45    #[serde(default = "crate::defaults::bool_false")]
46    pub dim_inactive_panes: bool,
47
48    /// Opacity level for inactive panes (0.0-1.0)
49    #[serde(default = "crate::defaults::inactive_pane_opacity")]
50    pub inactive_pane_opacity: f32,
51
52    /// Show title bar on each pane
53    #[serde(default = "crate::defaults::bool_false")]
54    pub show_pane_titles: bool,
55
56    /// Height of pane title bars in pixels
57    #[serde(default = "crate::defaults::pane_title_height")]
58    pub pane_title_height: f32,
59
60    /// Position of pane title bars (top or bottom)
61    #[serde(default)]
62    pub pane_title_position: PaneTitlePosition,
63
64    /// Pane title text color [R, G, B] (0-255)
65    #[serde(default = "crate::defaults::pane_title_color")]
66    pub pane_title_color: [u8; 3],
67
68    /// Pane title background color [R, G, B] (0-255)
69    #[serde(default = "crate::defaults::pane_title_bg_color")]
70    pub pane_title_bg_color: [u8; 3],
71
72    /// Pane title font family (empty string = use terminal font)
73    #[serde(default)]
74    pub pane_title_font: String,
75
76    /// Style of dividers between panes (solid, double, dashed, shadow)
77    #[serde(default)]
78    pub pane_divider_style: DividerStyle,
79
80    /// Maximum panes per tab (0 = unlimited)
81    #[serde(default = "crate::defaults::max_panes")]
82    pub max_panes: usize,
83
84    /// Show visual indicator (border) around focused pane
85    #[serde(default = "crate::defaults::bool_true")]
86    pub pane_focus_indicator: bool,
87
88    /// Color of the focused pane indicator [R, G, B] (0-255)
89    #[serde(default = "crate::defaults::pane_focus_color")]
90    pub pane_focus_color: [u8; 3],
91
92    /// Width of the focused pane indicator border in pixels
93    #[serde(default = "crate::defaults::pane_focus_width")]
94    pub pane_focus_width: f32,
95}
96
97impl Default for PaneConfig {
98    fn default() -> Self {
99        Self {
100            pane_divider_width: crate::defaults::pane_divider_width(),
101            pane_divider_hit_width: crate::defaults::pane_divider_hit_width(),
102            pane_padding: crate::defaults::pane_padding(),
103            pane_min_size: crate::defaults::pane_min_size(),
104            pane_background_opacity: crate::defaults::pane_background_opacity(),
105            pane_divider_color: crate::defaults::pane_divider_color(),
106            pane_divider_hover_color: crate::defaults::pane_divider_hover_color(),
107            dim_inactive_panes: crate::defaults::bool_false(),
108            inactive_pane_opacity: crate::defaults::inactive_pane_opacity(),
109            show_pane_titles: crate::defaults::bool_false(),
110            pane_title_height: crate::defaults::pane_title_height(),
111            pane_title_position: PaneTitlePosition::default(),
112            pane_title_color: crate::defaults::pane_title_color(),
113            pane_title_bg_color: crate::defaults::pane_title_bg_color(),
114            pane_title_font: String::new(),
115            pane_divider_style: DividerStyle::default(),
116            max_panes: crate::defaults::max_panes(),
117            pane_focus_indicator: crate::defaults::bool_true(),
118            pane_focus_color: crate::defaults::pane_focus_color(),
119            pane_focus_width: crate::defaults::pane_focus_width(),
120        }
121    }
122}