1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//! SSH settings section for the settings UI.
//!
//! Rendered as a collapsing section inside the Integrations tab.
use crate::SettingsUI;
use crate::section::collapsing_section;
use std::collections::HashSet;
impl SettingsUI {
/// Render the SSH settings as a collapsing section (used inside Integrations tab).
pub(crate) fn show_ssh_tab_as_section(
&mut self,
ui: &mut egui::Ui,
changes_this_frame: &mut bool,
collapsed: &mut HashSet<String>,
) {
collapsing_section(ui, "SSH", "integrations_ssh", true, collapsed, |ui| {
ui.group(|ui| {
ui.label(egui::RichText::new("Profile Auto-Switching").strong());
ui.add_space(4.0);
if ui
.checkbox(
&mut self.config.ssh.ssh_auto_profile_switch,
"Auto-switch profile on SSH connection",
)
.changed()
{
self.has_changes = true;
*changes_this_frame = true;
}
ui.label(
egui::RichText::new(
"Automatically switch to a matching profile when an SSH hostname is detected.",
)
.weak()
.size(11.0),
);
ui.add_space(4.0);
if ui
.checkbox(
&mut self.config.ssh.ssh_revert_profile_on_disconnect,
"Revert profile on SSH disconnect",
)
.changed()
{
self.has_changes = true;
*changes_this_frame = true;
}
ui.label(
egui::RichText::new(
"Switch back to the previous profile when the SSH session ends.",
)
.weak()
.size(11.0),
);
});
ui.add_space(8.0);
ui.group(|ui| {
ui.label(egui::RichText::new("mDNS/Bonjour Discovery").strong());
ui.add_space(4.0);
if ui
.checkbox(
&mut self.config.ssh.enable_mdns_discovery,
"Enable mDNS host discovery",
)
.changed()
{
self.has_changes = true;
*changes_this_frame = true;
}
ui.label(
egui::RichText::new(
"Discover SSH hosts on the local network via Bonjour/mDNS.",
)
.weak()
.size(11.0),
);
ui.add_space(4.0);
ui.horizontal(|ui| {
ui.label("Scan timeout (seconds):");
let mut timeout = self.config.ssh.mdns_scan_timeout_secs as f32;
if ui
.add(egui::Slider::new(&mut timeout, 1.0..=10.0).integer())
.changed()
{
self.config.ssh.mdns_scan_timeout_secs = timeout as u32;
self.has_changes = true;
*changes_this_frame = true;
}
});
});
ui.add_space(8.0);
ui.group(|ui| {
ui.label(egui::RichText::new("Quick Connect").strong());
ui.add_space(4.0);
ui.label("Press Cmd+Shift+S to open the SSH Quick Connect dialog.");
ui.label(
egui::RichText::new(
"The dialog shows hosts from SSH config, known_hosts, shell history, and mDNS.",
)
.weak()
.size(11.0),
);
});
});
}
}
/// Search keywords for the SSH settings tab.
pub fn keywords() -> &'static [&'static str] {
&[
"ssh",
"remote",
"host",
"connect",
"quick connect",
"mdns",
"bonjour",
"discovery",
"auto-switch",
"auto switch",
"profile switch",
"hostname",
"known hosts",
// Auto-switch extras
"revert profile",
"disconnect",
// mDNS extras
"scan timeout",
]
}