From 6d3b7f2f64210fe2290ff4128b862c13edc391e9 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Thu, 4 Sep 2025 21:02:41 +0100 Subject: [PATCH] Add settings --- ShhShell/Settings/AppSettings.swift | 3 ++- ShhShell/Terminal/SSHTerminalDelegate.swift | 2 +- ShhShell/Views/Settings/SettingsView.swift | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ShhShell/Settings/AppSettings.swift b/ShhShell/Settings/AppSettings.swift index 9fbdb7a..b9f0d42 100644 --- a/ShhShell/Settings/AppSettings.swift +++ b/ShhShell/Settings/AppSettings.swift @@ -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 diff --git a/ShhShell/Terminal/SSHTerminalDelegate.swift b/ShhShell/Terminal/SSHTerminalDelegate.swift index d75dec1..0a0e2cf 100644 --- a/ShhShell/Terminal/SSHTerminalDelegate.swift +++ b/ShhShell/Terminal/SSHTerminalDelegate.swift @@ -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() } diff --git a/ShhShell/Views/Settings/SettingsView.swift b/ShhShell/Views/Settings/SettingsView.swift index b3938cd..182c798 100644 --- a/ShhShell/Views/Settings/SettingsView.swift +++ b/ShhShell/Views/Settings/SettingsView.swift @@ -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") {