mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 05:19:13 +00:00
Add settings
This commit is contained in:
@@ -7,11 +7,12 @@
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import SwiftTerm
|
||||
@preconcurrency import SwiftTerm
|
||||
|
||||
struct AppSettings: Codable, Sendable, Equatable {
|
||||
var scrollback: CGFloat = 10_000
|
||||
var cursorType: CursorType = CursorType()
|
||||
var cursorAnimations: CursorAnimations = CursorAnimations()
|
||||
var locationPersist: Bool = false
|
||||
var bellSound: Bool = false
|
||||
var bellHaptic: Bool = true
|
||||
|
||||
@@ -29,12 +29,12 @@ final class SSHTerminalDelegate: TerminalView, Sendable, @preconcurrency Termina
|
||||
restoreScrollback()
|
||||
if let hostsManager {
|
||||
font = UIFont(name: hostsManager.selectedFont, size: hostsManager.fontSize)!
|
||||
getTerminal().setCursorAnimations(hostsManager.settings.cursorAnimations)
|
||||
}
|
||||
applySelectedTheme()
|
||||
applyScrollbackLength()
|
||||
applyCursorType()
|
||||
getTerminal().registerOscHandler(code: 133, handler: { _ in })
|
||||
getTerminal().setCursorAnimations(CursorAnimations(type: .stretchAndMove, length: 0.2))
|
||||
self.startFeedLoop()
|
||||
let _ = self.becomeFirstResponder()
|
||||
}
|
||||
|
||||
@@ -108,6 +108,22 @@ struct SettingsView: View {
|
||||
}
|
||||
.pickerStyle(.inline)
|
||||
.labelsHidden()
|
||||
|
||||
Picker("Animation Type", selection: $hostsManager.settings.cursorAnimations.type) {
|
||||
ForEach(CursorAnimationType.allCases, id: \.self) { animType in
|
||||
Text(animType.description).tag(animType)
|
||||
}
|
||||
}
|
||||
|
||||
Slider(value: $hostsManager.settings.cursorAnimations.length, in: 0.05...0.5, step: 0.05) {
|
||||
Label("Speed", systemImage: "gauge.with.dots.needle.67percent")
|
||||
}
|
||||
.disabled(hostsManager.settings.cursorAnimations.type == .none)
|
||||
|
||||
Slider(value: $hostsManager.settings.cursorAnimations.stretchMultiplier, in: 0.25...2, step: 0.25) {
|
||||
Label("Stretch Multiplier", systemImage: "multiply")
|
||||
}
|
||||
.disabled(hostsManager.settings.cursorAnimations.type != .stretchAndMove)
|
||||
}
|
||||
|
||||
Section("Keepalive") {
|
||||
|
||||
Reference in New Issue
Block a user