tear_types/window.rs
1//! Window — a named tab inside a session, holding a layout tree.
2
3use serde::{Deserialize, Serialize};
4
5use crate::{id::WindowId, layout::LayoutNode};
6
7/// One window: a named tab that holds a binary-tree layout of panes.
8/// Windows are created/destroyed independently of their parent
9/// session and have their own active-pane focus.
10#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11pub struct TearWindow {
12 pub id: WindowId,
13 /// Display name shown in the status bar's window list.
14 pub name: String,
15 /// Pane layout. Pane ids referenced here must exist in the
16 /// parent session's pane map.
17 pub layout: LayoutNode,
18 /// Which pane gets keystrokes. Must be a leaf in `layout`.
19 pub active_pane: crate::id::PaneId,
20 /// Window size in terminal cells (cols, rows).
21 pub size_cells: (u16, u16),
22 /// Lifecycle state.
23 pub state: WindowState,
24}
25
26/// Window lifecycle states.
27#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
28#[serde(rename_all = "lowercase")]
29pub enum WindowState {
30 /// At least one pane is running.
31 Active,
32 /// All panes have exited. Window may be kept open per
33 /// `remain-on-exit` semantics.
34 Closed,
35}