mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 05:19:13 +00:00
save settings on modify settings
updated icon picker
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user