mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
Move terminal selection to Advanced
This commit is contained in:
parent
f23dc80a38
commit
784de80714
2 changed files with 68 additions and 46 deletions
|
|
@ -59,6 +59,9 @@ struct AdvancedSettingsView: View {
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Terminal preference section
|
||||||
|
TerminalPreferenceSection()
|
||||||
|
|
||||||
// Advanced section
|
// Advanced section
|
||||||
Section {
|
Section {
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
|
|
@ -94,3 +97,68 @@ struct AdvancedSettingsView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Terminal Preference Section
|
||||||
|
|
||||||
|
private struct TerminalPreferenceSection: View {
|
||||||
|
@AppStorage("preferredTerminal") private var preferredTerminal = Terminal.terminal.rawValue
|
||||||
|
@State private var terminalLauncher = TerminalLauncher.shared
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Section {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
HStack {
|
||||||
|
Text("Preferred Terminal")
|
||||||
|
Spacer()
|
||||||
|
Picker("", selection: $preferredTerminal) {
|
||||||
|
ForEach(Terminal.installed, id: \.rawValue) { terminal in
|
||||||
|
HStack {
|
||||||
|
if let icon = terminal.appIcon {
|
||||||
|
Image(nsImage: icon)
|
||||||
|
.resizable()
|
||||||
|
.frame(width: 16, height: 16)
|
||||||
|
}
|
||||||
|
Text(terminal.displayName)
|
||||||
|
}
|
||||||
|
.tag(terminal.rawValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pickerStyle(.menu)
|
||||||
|
.labelsHidden()
|
||||||
|
}
|
||||||
|
Text("Select which terminal application to use when creating new sessions")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
|
||||||
|
// Test button
|
||||||
|
HStack {
|
||||||
|
Text("Test Terminal")
|
||||||
|
Spacer()
|
||||||
|
Button("Test with 'banner hi'") {
|
||||||
|
Task {
|
||||||
|
do {
|
||||||
|
try terminalLauncher.launchCommand("banner hi")
|
||||||
|
} catch {
|
||||||
|
print("Failed to launch terminal test: \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.buttonStyle(.bordered)
|
||||||
|
}
|
||||||
|
Text("Opens a new terminal window with a test command")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
|
} header: {
|
||||||
|
Text("Terminal")
|
||||||
|
.font(.headline)
|
||||||
|
} footer: {
|
||||||
|
Text(
|
||||||
|
"VibeTunnel will use this terminal when launching new terminal sessions."
|
||||||
|
)
|
||||||
|
.font(.caption)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,6 @@ struct DebugSettingsView: View {
|
||||||
logLevel: $logLevel
|
logLevel: $logLevel
|
||||||
)
|
)
|
||||||
|
|
||||||
TerminalPreferenceSection()
|
|
||||||
|
|
||||||
DeveloperToolsSection(
|
DeveloperToolsSection(
|
||||||
showPurgeConfirmation: $showPurgeConfirmation,
|
showPurgeConfirmation: $showPurgeConfirmation,
|
||||||
showServerConsole: showServerConsole,
|
showServerConsole: showServerConsole,
|
||||||
|
|
@ -630,47 +628,3 @@ private struct DeveloperToolsSection: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Terminal Preference Section
|
|
||||||
|
|
||||||
private struct TerminalPreferenceSection: View {
|
|
||||||
@AppStorage("preferredTerminal") private var preferredTerminal = Terminal.terminal.rawValue
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
Section {
|
|
||||||
VStack(alignment: .leading, spacing: 8) {
|
|
||||||
HStack {
|
|
||||||
Text("Preferred Terminal")
|
|
||||||
Spacer()
|
|
||||||
Picker("", selection: $preferredTerminal) {
|
|
||||||
ForEach(Terminal.installed, id: \.rawValue) { terminal in
|
|
||||||
HStack {
|
|
||||||
if let icon = terminal.appIcon {
|
|
||||||
Image(nsImage: icon)
|
|
||||||
.resizable()
|
|
||||||
.frame(width: 16, height: 16)
|
|
||||||
}
|
|
||||||
Text(terminal.displayName)
|
|
||||||
}
|
|
||||||
.tag(terminal.rawValue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.pickerStyle(.menu)
|
|
||||||
.labelsHidden()
|
|
||||||
}
|
|
||||||
Text("Select which terminal application to use when creating new sessions")
|
|
||||||
.font(.caption)
|
|
||||||
.foregroundStyle(.secondary)
|
|
||||||
}
|
|
||||||
} header: {
|
|
||||||
Text("Terminal Preference")
|
|
||||||
.font(.headline)
|
|
||||||
} footer: {
|
|
||||||
Text(
|
|
||||||
"VibeTunnel will use this terminal when launching new terminal sessions. Falls back to Terminal if the selected app is not available."
|
|
||||||
)
|
|
||||||
.font(.caption)
|
|
||||||
.frame(maxWidth: .infinity)
|
|
||||||
.multilineTextAlignment(.center)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue