rmux_proto/request/keys.rs
1use serde::{Deserialize, Serialize};
2
3use crate::PaneTarget;
4
5/// Request payload for `bind-key`.
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7pub struct BindKeyRequest {
8 /// The key table to update.
9 pub table_name: String,
10 /// The raw tmux key string.
11 pub key: String,
12 /// The optional binding note.
13 pub note: Option<String>,
14 /// Whether the binding should repeat.
15 pub repeat: bool,
16 /// Optional command tokens. `None` means modify the existing binding in place.
17 pub command: Option<Vec<String>>,
18}
19
20/// Request payload for `unbind-key`.
21#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
22pub struct UnbindKeyRequest {
23 /// The key table to update.
24 pub table_name: String,
25 /// Whether every binding in the table should be removed.
26 pub all: bool,
27 /// The optional key to remove.
28 pub key: Option<String>,
29 /// Whether missing-table and missing-key diagnostics should be suppressed.
30 pub quiet: bool,
31}
32
33/// Request payload for `list-keys`.
34#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
35pub struct ListKeysRequest {
36 /// The optional key table to list.
37 pub table_name: Option<String>,
38 /// Whether only the first matching entry should be returned.
39 pub first_only: bool,
40 /// Whether notes mode is active.
41 pub notes: bool,
42 /// Whether notes mode should include bindings without notes.
43 pub include_unnoted: bool,
44 /// Whether the listing should be reversed.
45 pub reversed: bool,
46 /// Optional custom output format.
47 pub format: Option<String>,
48 /// Optional sort-order token.
49 pub sort_order: Option<String>,
50 /// Optional literal prefix inserted before each rendered line.
51 pub prefix: Option<String>,
52 /// Optional key filter.
53 pub key: Option<String>,
54}
55
56/// Request payload for `send-prefix`.
57#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
58pub struct SendPrefixRequest {
59 /// The optional explicit pane target.
60 pub target: Option<PaneTarget>,
61 /// Whether `prefix2` should be used instead of `prefix`.
62 pub secondary: bool,
63}
64
65/// Request payload for `copy-mode`.
66#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
67pub struct CopyModeRequest {
68 /// The optional target pane. When omitted, the active pane is used.
69 pub target: Option<PaneTarget>,
70 /// Whether copy-mode should start one page down.
71 #[serde(default)]
72 pub page_down: bool,
73 /// Whether scroll exit should be enabled when entering the mode.
74 #[serde(default)]
75 pub exit_on_scroll: bool,
76 /// Whether the position indicator should be hidden.
77 #[serde(default)]
78 pub hide_position: bool,
79 /// Whether the command originated from a mouse drag start.
80 #[serde(default)]
81 pub mouse_drag_start: bool,
82 /// Whether all active pane modes should be cancelled instead of entering.
83 #[serde(default)]
84 pub cancel_mode: bool,
85 /// Whether the command originated from scrollbar scrolling.
86 #[serde(default)]
87 pub scrollbar_scroll: bool,
88 /// Optional source pane whose screen should back the copy-mode view.
89 #[serde(default)]
90 pub source: Option<PaneTarget>,
91 /// Whether copy-mode should start one page up.
92 #[serde(default)]
93 pub page_up: bool,
94}
95
96/// Request payload for `clock-mode`.
97#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
98pub struct ClockModeRequest {
99 /// The optional exact target pane. When omitted, the active pane is used.
100 pub target: Option<PaneTarget>,
101}