mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
save settings on modify settings
updated icon picker
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct AppSettings: Codable, Sendable {
|
struct AppSettings: Codable, Sendable, Equatable {
|
||||||
var scrollback: CGFloat = 1_000
|
var scrollback: CGFloat = 1_000
|
||||||
var cursorStyle: CursorStyle = .block
|
var cursorStyle: CursorStyle = .block
|
||||||
var locationPersist: Bool = false
|
var locationPersist: Bool = false
|
||||||
@@ -19,17 +19,17 @@ struct AppSettings: Codable, Sendable {
|
|||||||
var appIcon: AppIcon = .regular
|
var appIcon: AppIcon = .regular
|
||||||
}
|
}
|
||||||
|
|
||||||
enum CursorStyle: Codable, CaseIterable {
|
enum CursorStyle: Codable, CaseIterable, Equatable {
|
||||||
case block
|
case block
|
||||||
case bar
|
case bar
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TerminalFilter: Codable, CaseIterable {
|
enum TerminalFilter: Codable, CaseIterable, Equatable {
|
||||||
case none
|
case none
|
||||||
case crt
|
case crt
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AppIcon: Codable, CaseIterable {
|
enum AppIcon: Codable, CaseIterable, Equatable {
|
||||||
case regular
|
case regular
|
||||||
case blueprint
|
case blueprint
|
||||||
|
|
||||||
|
|||||||
@@ -51,17 +51,30 @@ struct SettingsView: View {
|
|||||||
Text("\(filter)").tag(filter)
|
Text("\(filter)").tag(filter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.pickerStyle(.inline)
|
||||||
|
|
||||||
Picker("appicon", selection: $hostsManager.settings.appIcon) {
|
Section("App Icon") {
|
||||||
ForEach(AppIcon.allCases, id: \.self) { icon in
|
HStack {
|
||||||
Text("\(icon)").tag(icon)
|
ForEach(AppIcon.allCases, id: \.self) { icon in
|
||||||
icon.image
|
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)
|
.listStyle(.sidebar)
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
|
.onChange(of: hostsManager.settings) { _ in
|
||||||
|
hostsManager.saveSettings()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user