mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
apply to terimal
This commit is contained in:
@@ -12,102 +12,90 @@ struct ContentView: View {
|
||||
@ObservedObject var hostsManager: HostsManager
|
||||
@ObservedObject var keyManager: KeyManager
|
||||
|
||||
@State private var spawnTime: Date = .now
|
||||
|
||||
var body: some View {
|
||||
TimelineView(.animation) { tl in
|
||||
let time = tl.date.distance(to: spawnTime)
|
||||
NavigationStack {
|
||||
ZStack {
|
||||
hostsManager.selectedTheme.background.suiColor.opacity(0.7)
|
||||
.ignoresSafeArea(.all)
|
||||
List {
|
||||
SessionsListView(
|
||||
handler: handler,
|
||||
hostsManager: hostsManager,
|
||||
keyManager: keyManager
|
||||
)
|
||||
|
||||
RecentsView(
|
||||
hostsManager: hostsManager,
|
||||
keyManager: keyManager
|
||||
)
|
||||
|
||||
HostsView(
|
||||
handler: handler,
|
||||
hostsManager: hostsManager,
|
||||
keyManager: keyManager
|
||||
)
|
||||
|
||||
Section() {
|
||||
NavigationLink {
|
||||
ThemeManagerView(hostsManager: hostsManager)
|
||||
} label: {
|
||||
Label("Themes", systemImage: "swatchpalette")
|
||||
}
|
||||
NavigationLink {
|
||||
FontManagerView(hostsManager: hostsManager)
|
||||
} label: {
|
||||
Label("Fonts", systemImage: "textformat")
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
NavigationLink {
|
||||
SnippetManagerView(hostsManager: hostsManager)
|
||||
} label: {
|
||||
Label("Snippets", systemImage: "paperclip")
|
||||
}
|
||||
|
||||
NavigationLink {
|
||||
KeyManagerView(hostsManager: hostsManager, keyManager: keyManager)
|
||||
} label: {
|
||||
Label("Keys", systemImage: "key.fill")
|
||||
}
|
||||
|
||||
NavigationLink {
|
||||
HostkeysView(hostsManager: hostsManager)
|
||||
} label: {
|
||||
Label("Hostkey Fingerprints", systemImage: "lock.display")
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
NavigationLink {
|
||||
SettingsView(hostsManager: hostsManager, keyManager: keyManager)
|
||||
} label: {
|
||||
Label("Settings", systemImage: "gear")
|
||||
}
|
||||
NavigationLink {
|
||||
AboutView(hostsManager: hostsManager)
|
||||
} label: {
|
||||
Label("About", systemImage: "info.square")
|
||||
}
|
||||
}
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
}
|
||||
.navigationTitle("ShhShell")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
NavigationStack {
|
||||
ZStack {
|
||||
hostsManager.selectedTheme.background.suiColor.opacity(0.7)
|
||||
.ignoresSafeArea(.all)
|
||||
List {
|
||||
SessionsListView(
|
||||
handler: handler,
|
||||
hostsManager: hostsManager,
|
||||
keyManager: keyManager
|
||||
)
|
||||
|
||||
RecentsView(
|
||||
hostsManager: hostsManager,
|
||||
keyManager: keyManager
|
||||
)
|
||||
|
||||
HostsView(
|
||||
handler: handler,
|
||||
hostsManager: hostsManager,
|
||||
keyManager: keyManager
|
||||
)
|
||||
|
||||
Section() {
|
||||
NavigationLink {
|
||||
ConnectionView(
|
||||
handler: SSHHandler(host: Host.blank, keyManager: keyManager),
|
||||
hostsManager: hostsManager,
|
||||
keyManager: keyManager
|
||||
)
|
||||
ThemeManagerView(hostsManager: hostsManager)
|
||||
} label: {
|
||||
Label("Add", systemImage: "plus")
|
||||
Label("Themes", systemImage: "swatchpalette")
|
||||
}
|
||||
NavigationLink {
|
||||
FontManagerView(hostsManager: hostsManager)
|
||||
} label: {
|
||||
Label("Fonts", systemImage: "textformat")
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
NavigationLink {
|
||||
SnippetManagerView(hostsManager: hostsManager)
|
||||
} label: {
|
||||
Label("Snippets", systemImage: "paperclip")
|
||||
}
|
||||
|
||||
NavigationLink {
|
||||
KeyManagerView(hostsManager: hostsManager, keyManager: keyManager)
|
||||
} label: {
|
||||
Label("Keys", systemImage: "key.fill")
|
||||
}
|
||||
|
||||
NavigationLink {
|
||||
HostkeysView(hostsManager: hostsManager)
|
||||
} label: {
|
||||
Label("Hostkey Fingerprints", systemImage: "lock.display")
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
NavigationLink {
|
||||
SettingsView(hostsManager: hostsManager, keyManager: keyManager)
|
||||
} label: {
|
||||
Label("Settings", systemImage: "gear")
|
||||
}
|
||||
NavigationLink {
|
||||
AboutView(hostsManager: hostsManager)
|
||||
} label: {
|
||||
Label("About", systemImage: "info.square")
|
||||
}
|
||||
}
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
}
|
||||
.visualEffect { content, proxy in
|
||||
content
|
||||
.colorEffect(ShaderLibrary.crt(
|
||||
.float2(proxy.size),
|
||||
.float(time)
|
||||
))
|
||||
.navigationTitle("ShhShell")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
NavigationLink {
|
||||
ConnectionView(
|
||||
handler: SSHHandler(host: Host.blank, keyManager: keyManager),
|
||||
hostsManager: hostsManager,
|
||||
keyManager: keyManager
|
||||
)
|
||||
} label: {
|
||||
Label("Add", systemImage: "plus")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,7 +103,7 @@ struct ContentView: View {
|
||||
|
||||
#Preview {
|
||||
let keymanager = KeyManager()
|
||||
ContentView(
|
||||
ContentView(
|
||||
handler: SSHHandler(host: Host.debug, keyManager: keymanager),
|
||||
hostsManager: HostsManager(),
|
||||
keyManager: keymanager
|
||||
|
||||
@@ -16,32 +16,48 @@ struct ShellView: View {
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
@State var startTime: Date = .now
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
ZStack {
|
||||
hostsManager.selectedTheme.background.suiColor
|
||||
.ignoresSafeArea(.all)
|
||||
TerminalController(handler: handler, hostsManager: hostsManager)
|
||||
|
||||
Group {
|
||||
Color.gray.opacity(0.2)
|
||||
.transition(.opacity)
|
||||
Image(systemName: "bell.fill")
|
||||
.foregroundStyle(
|
||||
hostsManager.selectedTheme.background.luminance > 0.5 ?
|
||||
.black : .white
|
||||
)
|
||||
.font(.largeTitle)
|
||||
.shadow(color: .black, radius: 5)
|
||||
}
|
||||
.opacity(handler.bell ? 1 : 0)
|
||||
.onChange(of: handler.bell) { _ in
|
||||
guard handler.bell else { return }
|
||||
if hostsManager.settings.bellHaptic {
|
||||
Haptic.warning.trigger()
|
||||
TimelineView(.animation) { tl in
|
||||
let time = tl.date.distance(to: startTime)
|
||||
let shaderEnabled = hostsManager.settings.filter == .crt
|
||||
hostsManager.selectedTheme.background.suiColor
|
||||
.ignoresSafeArea(.all)
|
||||
TerminalController(handler: handler, hostsManager: hostsManager)
|
||||
|
||||
Group {
|
||||
Color.gray.opacity(0.2)
|
||||
.transition(.opacity)
|
||||
Image(systemName: "bell.fill")
|
||||
.foregroundStyle(
|
||||
hostsManager.selectedTheme.background.luminance > 0.5 ?
|
||||
.black : .white
|
||||
)
|
||||
.font(.largeTitle)
|
||||
.shadow(color: .black, radius: 5)
|
||||
}
|
||||
if hostsManager.settings.bellSound {
|
||||
AudioServicesPlaySystemSound(1103)
|
||||
.opacity(handler.bell ? 1 : 0)
|
||||
.onChange(of: handler.bell) { _ in
|
||||
guard handler.bell else { return }
|
||||
if hostsManager.settings.bellHaptic {
|
||||
Haptic.warning.trigger()
|
||||
}
|
||||
if hostsManager.settings.bellSound {
|
||||
AudioServicesPlaySystemSound(1103)
|
||||
}
|
||||
}
|
||||
.visualEffect { content, proxy in
|
||||
content
|
||||
.colorEffect(
|
||||
ShaderLibrary.crt(
|
||||
.float2(proxy.size),
|
||||
.float(time)
|
||||
),
|
||||
isEnabled: shaderEnabled
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user