diff --git a/ShhShell/Settings/AppSettings.swift b/ShhShell/Settings/AppSettings.swift index fd665a0..7352758 100644 --- a/ShhShell/Settings/AppSettings.swift +++ b/ShhShell/Settings/AppSettings.swift @@ -8,7 +8,7 @@ import Foundation import SwiftUI -struct AppSettings: Codable, Sendable { +struct AppSettings: Codable, Sendable, Equatable { var scrollback: CGFloat = 1_000 var cursorStyle: CursorStyle = .block var locationPersist: Bool = false @@ -19,17 +19,17 @@ struct AppSettings: Codable, Sendable { var appIcon: AppIcon = .regular } -enum CursorStyle: Codable, CaseIterable { +enum CursorStyle: Codable, CaseIterable, Equatable { case block case bar } -enum TerminalFilter: Codable, CaseIterable { +enum TerminalFilter: Codable, CaseIterable, Equatable { case none case crt } -enum AppIcon: Codable, CaseIterable { +enum AppIcon: Codable, CaseIterable, Equatable { case regular case blueprint diff --git a/ShhShell/Views/Settings/SettingsView.swift b/ShhShell/Views/Settings/SettingsView.swift index 7afbd2f..8e24c7e 100644 --- a/ShhShell/Views/Settings/SettingsView.swift +++ b/ShhShell/Views/Settings/SettingsView.swift @@ -51,17 +51,30 @@ struct SettingsView: View { Text("\(filter)").tag(filter) } } + .pickerStyle(.inline) - Picker("appicon", selection: $hostsManager.settings.appIcon) { - ForEach(AppIcon.allCases, id: \.self) { icon in - Text("\(icon)").tag(icon) - icon.image + Section("App Icon") { + HStack { + ForEach(AppIcon.allCases, id: \.self) { icon in + VStack(alignment: .center) { + icon.image + .resizable().scaledToFit() + .frame(maxWidth: 50) + .clipShape(RoundedRectangle(cornerRadius: 11)) + Text("\(icon)").tag(icon) + } + .onTapGesture { + hostsManager.settings.appIcon = icon + } + } } } - .pickerStyle(.inline) } .listStyle(.sidebar) .scrollContentBackground(.hidden) + .onChange(of: hostsManager.settings) { _ in + hostsManager.saveSettings() + } } } }