save settings on modify settings

updated icon picker
This commit is contained in:
neon443 committed 2025-08-20 17:16:32 +01:00
1 parent 0b16e15044
commit 8fd10bb291
2 files changed
+22 -9

No files matched your search

+4 -4
View File
@@ -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
+18 -5
View File
@@ -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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.