Skip to main content

par_term_config/config/config_struct/
scrollbar_config.rs

1//! Scrollbar appearance and behaviour 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 serde::{Deserialize, Serialize};
8
9/// Scrollbar placement, size, colours, command marks and auto-hide.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct ScrollbarConfig {
12    /// Auto-hide scrollbar after inactivity (milliseconds, 0 = never hide)
13    #[serde(default = "crate::defaults::scrollbar_autohide_delay")]
14    pub scrollbar_autohide_delay: u64,
15
16    /// Scrollbar position (left or right)
17    #[serde(default = "crate::defaults::scrollbar_position")]
18    pub scrollbar_position: String,
19
20    /// Scrollbar width in pixels
21    #[serde(default = "crate::defaults::scrollbar_width")]
22    pub scrollbar_width: f32,
23
24    /// Scrollbar thumb color (RGBA: [r, g, b, a] where each is 0.0-1.0)
25    #[serde(default = "crate::defaults::scrollbar_thumb_color")]
26    pub scrollbar_thumb_color: [f32; 4],
27
28    /// Scrollbar track color (RGBA: [r, g, b, a] where each is 0.0-1.0)
29    #[serde(default = "crate::defaults::scrollbar_track_color")]
30    pub scrollbar_track_color: [f32; 4],
31
32    /// Show command markers on the scrollbar (requires shell integration)
33    #[serde(default = "crate::defaults::bool_true")]
34    pub scrollbar_command_marks: bool,
35
36    /// Show tooltips when hovering over scrollbar command markers
37    #[serde(default = "crate::defaults::bool_false")]
38    pub scrollbar_mark_tooltips: bool,
39}
40
41impl Default for ScrollbarConfig {
42    fn default() -> Self {
43        Self {
44            scrollbar_autohide_delay: crate::defaults::scrollbar_autohide_delay(),
45            scrollbar_position: crate::defaults::scrollbar_position(),
46            scrollbar_width: crate::defaults::scrollbar_width(),
47            scrollbar_thumb_color: crate::defaults::scrollbar_thumb_color(),
48            scrollbar_track_color: crate::defaults::scrollbar_track_color(),
49            scrollbar_command_marks: crate::defaults::bool_true(),
50            scrollbar_mark_tooltips: crate::defaults::bool_false(),
51        }
52    }
53}