par_term_config/config/config_struct/window_config.rs
1//! Window appearance and geometry configuration sub-struct extracted from `Config`.
2//!
3//! # Extraction Status (ARC-002)
4//!
5//! This is the first phase of window config extraction. The fields extracted here
6//! (`window_opacity`, `window_always_on_top`, `window_decorations`, `blur_enabled`,
7//! `blur_radius`, `window_padding`, `hide_window_padding_on_split`,
8//! `snap_window_to_grid`) are those most cohesively tied to the window *appearance*
9//! rather than its *behavior* or *layout*.
10//!
11//! Remaining window-related fields (`window_title`, `window_type`, `target_monitor`,
12//! `target_space`, `lock_window_size`, `show_window_number`, `max_fps`, `vsync_mode`,
13//! `power_preference`, `reduce_flicker`, etc.) remain on `Config` for now.
14//! They require a dedicated migration due to the large number of call sites.
15//!
16//! Fields serialise at the top level via `#[serde(flatten)]`, so existing
17//! `config.yaml` files require no changes.
18
19use serde::{Deserialize, Serialize};
20
21/// Window visual appearance settings extracted from the top-level `Config`.
22///
23/// See `Config::window` (flattened onto `Config`) for usage.
24#[derive(Debug, Clone, Serialize, Deserialize)]
25#[serde(default)]
26pub struct WindowConfig {
27 /// Window opacity/transparency (0.0 = fully transparent, 1.0 = fully opaque)
28 #[serde(default = "crate::defaults::window_opacity")]
29 pub window_opacity: f32,
30
31 /// Keep window always on top of other windows
32 #[serde(default = "crate::defaults::bool_false")]
33 pub window_always_on_top: bool,
34
35 /// Show window decorations (title bar, borders)
36 #[serde(default = "crate::defaults::bool_true")]
37 pub window_decorations: bool,
38
39 /// Enable window blur effect (macOS only).
40 /// Blurs content behind the transparent window for better readability.
41 #[serde(default = "crate::defaults::bool_false")]
42 pub blur_enabled: bool,
43
44 /// Blur radius in points (0–64, macOS only).
45 /// Higher values = more blur. Default: 8.
46 #[serde(default = "crate::defaults::blur_radius")]
47 pub blur_radius: u32,
48
49 /// Window padding in pixels.
50 #[serde(default = "crate::defaults::window_padding")]
51 pub window_padding: f32,
52
53 /// Automatically hide window padding when panes are split.
54 /// When true (default), window padding becomes 0 when the active tab has multiple panes.
55 #[serde(default = "crate::defaults::bool_true")]
56 pub hide_window_padding_on_split: bool,
57
58 /// Snap window dimensions to exact terminal cell boundaries during resize,
59 /// eliminating blank background gaps. Disabled automatically in split-pane mode.
60 #[serde(default = "crate::defaults::snap_window_to_grid")]
61 pub snap_window_to_grid: bool,
62}
63
64impl Default for WindowConfig {
65 fn default() -> Self {
66 Self {
67 window_opacity: crate::defaults::window_opacity(),
68 window_always_on_top: crate::defaults::bool_false(),
69 window_decorations: crate::defaults::bool_true(),
70 blur_enabled: crate::defaults::bool_false(),
71 blur_radius: crate::defaults::blur_radius(),
72 window_padding: crate::defaults::window_padding(),
73 hide_window_padding_on_split: crate::defaults::bool_true(),
74 snap_window_to_grid: crate::defaults::snap_window_to_grid(),
75 }
76 }
77}