par_term_config/config/config_struct/window_placement_config.rs
1//! Window placement and sizing constraints.
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::WindowType;
8use serde::{Deserialize, Serialize};
9
10/// Window type, target monitor/Space, resize lock and window numbering.
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct WindowPlacementConfig {
13 /// Window type (normal, fullscreen, or edge-anchored)
14 /// - normal: Standard window (default)
15 /// - fullscreen: Start in fullscreen mode
16 /// - edge_top/edge_bottom/edge_left/edge_right: Edge-anchored dropdown-style window
17 #[serde(default)]
18 pub window_type: WindowType,
19
20 /// Target monitor index for window placement (0 = primary)
21 /// Use None to let the OS decide window placement
22 #[serde(default)]
23 pub target_monitor: Option<usize>,
24
25 /// Target macOS Space (virtual desktop) for window placement (1-based ordinal)
26 /// Use None to let the OS decide which Space to open on.
27 /// Only effective on macOS; ignored on other platforms.
28 #[serde(default)]
29 pub target_space: Option<u32>,
30
31 /// Lock window size to prevent resize
32 /// When true, the window cannot be resized by the user
33 #[serde(default = "crate::defaults::bool_false")]
34 pub lock_window_size: bool,
35
36 /// Show window number in title bar
37 /// Useful when multiple par-term windows are open
38 #[serde(default = "crate::defaults::bool_false")]
39 pub show_window_number: bool,
40}
41
42impl Default for WindowPlacementConfig {
43 fn default() -> Self {
44 Self {
45 window_type: WindowType::default(),
46 target_monitor: None,
47 target_space: None,
48 lock_window_size: crate::defaults::bool_false(),
49 show_window_number: crate::defaults::bool_false(),
50 }
51 }
52}