Add helper for differrent vt name

This commit is contained in:
Peter Steinberger 2025-06-22 15:54:14 +02:00
parent b58524750b
commit 1ffabb048b

View file

@ -17,6 +17,7 @@ struct AdvancedSettingsView: View {
@AppStorage("showInDock") @AppStorage("showInDock")
private var showInDock = false private var showInDock = false
@State private var cliInstaller = CLIInstaller() @State private var cliInstaller = CLIInstaller()
@State private var showingVtConflictAlert = false
var body: some View { var body: some View {
NavigationStack { NavigationStack {
@ -74,14 +75,28 @@ struct AdvancedSettingsView: View {
Text(error) Text(error)
.font(.caption) .font(.caption)
.foregroundColor(.red) .foregroundColor(.red)
} else if cliInstaller.isInstalled {
Text("The 'vt' command line tool is installed at /usr/local/bin/vt")
.font(.caption)
.foregroundStyle(.secondary)
} else { } else {
Text("Install the 'vt' command line tool to /usr/local/bin for terminal access.") HStack(alignment: .center, spacing: 8) {
.font(.caption) if cliInstaller.isInstalled {
.foregroundStyle(.secondary) Text("The 'vt' command line tool is installed at /usr/local/bin/vt")
.font(.caption)
.foregroundStyle(.secondary)
} else {
Text("Install the 'vt' command line tool to /usr/local/bin for terminal access.")
.font(.caption)
.foregroundStyle(.secondary)
}
Spacer()
Button(action: {
showingVtConflictAlert = true
}) {
Text("Use a different name")
.font(.caption)
}
.buttonStyle(.link)
}
} }
} }
} header: { } header: {
@ -137,6 +152,14 @@ struct AdvancedSettingsView: View {
.onAppear { .onAppear {
cliInstaller.checkInstallationStatus() cliInstaller.checkInstallationStatus()
} }
.alert("Using a Different Command Name", isPresented: $showingVtConflictAlert) {
Button("OK") {}
Button("Copy to Clipboard") {
copyCommandToClipboard()
}
} message: {
Text(vtConflictMessage)
}
} }
private var showInDockBinding: Binding<Bool> { private var showInDockBinding: Binding<Bool> {
@ -159,12 +182,9 @@ struct AdvancedSettingsView: View {
private var vtConflictMessage: String { private var vtConflictMessage: String {
""" """
If 'vt' is already in use on your system, you can copy the VibeTunnel command script with a different name. You can install the `vt` bash script with a different name. For example:
Copy command:
cp "\(vtScriptPath)" /usr/local/bin/vtunnel && chmod +x /usr/local/bin/vtunnel cp "\(vtScriptPath)" /usr/local/bin/vtunnel && chmod +x /usr/local/bin/vtunnel
This will create 'vtunnel' as an alternative command name.
""" """
} }
@ -294,14 +314,6 @@ private struct TerminalPreferenceSection: View {
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
} }
.alert("Using a Different Command Name", isPresented: $showingVtConflictAlert) {
Button("OK") {}
Button("Copy to Clipboard") {
copyCommandToClipboard()
}
} message: {
Text(vtConflictMessage)
}
.alert(errorTitle, isPresented: $showingError) { .alert(errorTitle, isPresented: $showingError) {
Button("OK") {} Button("OK") {}
if errorTitle == "Permission Denied" { if errorTitle == "Permission Denied" {