Skip to main content

par_term_config/defaults/
terminal.rs

1//! Default values for terminal-behaviour settings.
2
3/// Default scrollback buffer size in lines.
4pub fn scrollback() -> usize {
5    10000
6}
7
8/// Default login shell flag (true = start as login shell).
9pub fn login_shell() -> bool {
10    true
11}
12
13/// Default initial text sent to the shell on startup.
14pub fn initial_text() -> String {
15    String::new()
16}
17
18/// Default delay in milliseconds before sending initial text.
19pub fn initial_text_delay_ms() -> u64 {
20    100
21}
22
23/// Default flag controlling whether a newline is appended to initial text.
24pub fn initial_text_send_newline() -> bool {
25    true
26}
27
28/// Default scrollbar position (`"right"` or `"left"`).
29pub fn scrollbar_position() -> String {
30    "right".to_string()
31}
32
33/// Default scrollbar width in pixels.
34pub fn scrollbar_width() -> f32 {
35    15.0
36}
37
38/// Default scrollbar auto-hide delay in milliseconds (0 = never auto-hide).
39pub fn scrollbar_autohide_delay() -> u64 {
40    0 // 0 = never auto-hide (always visible when scrollback exists)
41}
42
43/// Default paste delay in milliseconds between chunks (0 = no delay).
44pub fn paste_delay_ms() -> u64 {
45    0 // No delay by default
46}
47
48/// Default maximum number of clipboard sync events to buffer.
49pub fn clipboard_max_sync_events() -> usize {
50    64 // Aligned with sister project
51}
52
53/// Default maximum bytes per clipboard sync event.
54pub fn clipboard_max_event_bytes() -> usize {
55    2048 // Aligned with sister project
56}
57
58/// Whether OSC 52 clipboard-set sequences from programs (local or over SSH)
59/// are applied to the system clipboard. This is how remote apps like tmux or
60/// workspace managers reach the local clipboard over a plain terminal session.
61pub fn osc52_clipboard() -> bool {
62    true
63}
64
65/// Default maximum total OSC data length in bytes before a sequence is
66/// rejected by the core terminal (QA-012 memory-exhaustion guard).
67/// Matches `par_term_emu_core_rust::terminal::DEFAULT_MAX_OSC_DATA_LENGTH`.
68pub fn max_osc_data_length() -> usize {
69    128 * 1024 * 1024 // 128 MiB — large enough for inline images (iTerm2/Kitty base64)
70}
71
72/// Default activity threshold in seconds before a tab is considered idle.
73pub fn activity_threshold() -> u64 {
74    10 // Aligned with sister project (10 seconds)
75}
76
77/// Default anti-idle keep-alive interval in seconds.
78pub fn anti_idle_seconds() -> u64 {
79    60 // Default keep-alive interval: 60 seconds
80}
81
82/// Default anti-idle keep-alive byte code sent to the PTY.
83pub fn anti_idle_code() -> u8 {
84    0 // Default keep-alive code: NUL (0x00)
85}
86
87/// Default silence threshold in seconds before a silence notification fires.
88pub fn silence_threshold() -> u64 {
89    300 // 5 minutes
90}
91
92/// Default maximum number of notification lines to buffer.
93pub fn notification_max_buffer() -> usize {
94    64 // Aligned with sister project
95}
96
97/// Default mouse scroll speed in lines per scroll tick.
98pub fn scroll_speed() -> f32 {
99    3.0 // Lines per scroll tick
100}
101
102/// Default double-click interval threshold in milliseconds.
103pub fn double_click_threshold() -> u64 {
104    500 // 500 milliseconds
105}
106
107/// Default triple-click interval threshold in milliseconds.
108pub fn triple_click_threshold() -> u64 {
109    500 // 500 milliseconds (same as double-click)
110}
111
112/// Default cursor blink interval in milliseconds.
113pub fn cursor_blink_interval() -> u64 {
114    500 // 500 milliseconds (blink twice per second)
115}
116
117/// Default bell sound volume (0–100 percent).
118pub fn bell_sound() -> u8 {
119    50 // Default to 50% volume
120}
121
122/// Default set of non-alphanumeric characters treated as part of a word for double-click selection.
123pub fn word_characters() -> String {
124    // Default characters considered part of a word (in addition to alphanumeric)
125    // Matches iTerm2's default: /-+\~_.
126    "/-+\\~_.".to_string()
127}
128
129/// Default flag enabling smart selection for URLs and file paths.
130pub fn smart_selection_enabled() -> bool {
131    true // Smart selection enabled by default
132}
133
134/// Default answerback string sent in response to ENQ (empty = disabled).
135pub fn answerback_string() -> String {
136    String::new() // Empty/disabled by default for security
137}
138
139/// Default semantic history editor command
140/// Empty string means auto-detect from $EDITOR or use system default
141pub fn semantic_history_editor() -> String {
142    String::new() // Auto-detect by default
143}
144
145/// Default list of jobs/processes to ignore when checking for running jobs
146/// These are common shells and utilities that shouldn't block tab close
147pub fn jobs_to_ignore() -> Vec<String> {
148    vec![
149        // Common shells - these are the parent process, not "jobs"
150        "bash".to_string(),
151        "zsh".to_string(),
152        "fish".to_string(),
153        "sh".to_string(),
154        "dash".to_string(),
155        "ksh".to_string(),
156        "tcsh".to_string(),
157        "csh".to_string(),
158        // Common pagers and viewers
159        "less".to_string(),
160        "more".to_string(),
161        "man".to_string(),
162        // Common utilities that are often left running
163        "cat".to_string(),
164        "sleep".to_string(),
165    ]
166}
167
168/// Default session log directory (XDG-compliant: `~/.local/share/par-term/logs/`).
169pub fn session_log_directory() -> String {
170    // XDG-compliant default: ~/.local/share/par-term/logs/
171    if let Some(home) = dirs::home_dir() {
172        home.join(".local")
173            .join("share")
174            .join("par-term")
175            .join("logs")
176            .to_string_lossy()
177            .to_string()
178    } else {
179        "logs".to_string()
180    }
181}
182
183/// Default maximum number of command history entries to persist across sessions.
184pub fn command_history_max_entries() -> usize {
185    1000 // Maximum number of commands to persist across sessions
186}
187
188/// Default session undo timeout in seconds.
189pub fn session_undo_timeout_secs() -> u32 {
190    5
191}
192
193/// Default maximum number of session undo entries.
194pub fn session_undo_max_entries() -> usize {
195    10
196}
197
198/// Default flag controlling whether the shell process is preserved on session undo.
199pub fn session_undo_preserve_shell() -> bool {
200    false
201}