Skip to main content

rmux_proto/request/
layout.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{LayoutName, SessionName, WindowTarget};
4
5/// Target forms accepted by `select-layout`.
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7pub enum SelectLayoutTarget {
8    /// Applies to the addressed session's single V1 window.
9    Session(SessionName),
10    /// Applies to the addressed V1 window target.
11    Window(WindowTarget),
12}
13
14/// Request payload for `select-layout`.
15#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
16pub struct SelectLayoutRequest {
17    /// The exact layout target.
18    pub target: SelectLayoutTarget,
19    /// The requested layout.
20    pub layout: LayoutName,
21}
22
23/// Request payload for `select-layout` with a custom layout string.
24#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
25pub struct SelectCustomLayoutRequest {
26    /// The exact layout target.
27    pub target: SelectLayoutTarget,
28    /// The tmux custom layout string, including checksum.
29    pub layout: String,
30}
31
32/// Request payload for `select-layout -o`.
33#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
34pub struct SelectOldLayoutRequest {
35    /// The exact layout target.
36    pub target: SelectLayoutTarget,
37}
38
39/// Request payload for `select-layout -E`.
40#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
41pub struct SpreadLayoutRequest {
42    /// The exact layout target.
43    pub target: SelectLayoutTarget,
44}
45
46/// Request payload for `next-layout`.
47#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
48pub struct NextLayoutRequest {
49    /// The exact window target.
50    pub target: WindowTarget,
51}
52
53/// Request payload for `previous-layout`.
54#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
55pub struct PreviousLayoutRequest {
56    /// The exact window target.
57    pub target: WindowTarget,
58}