hardcoded a wip jellycursor

This commit is contained in:
neon443
2025-08-29 23:38:31 +01:00
parent dc01156d9c
commit 09a6e5a029
5 changed files with 42 additions and 8 deletions

View File

@@ -7,6 +7,7 @@
import Foundation
import LibSSH
import libssh2
import OSLog
import SwiftUI
import SwiftTerm

View File

@@ -52,9 +52,18 @@ final class SSHTerminalDelegate: TerminalView, Sendable, @preconcurrency Termina
}
}
override func showCursor(source: Terminal) {
super.showCursor(source: source)
print("showcursor called")
}
override func hideCursor(source: Terminal) {
super.hideCursor(source: source)
print("hide cursor called")
}
override func cursorStyleChanged(source: Terminal, newStyle: CursorStyle) {
super.cursorStyleChanged(source: source, newStyle: newStyle)
}
func startFeedLoop() {

View File

@@ -148,10 +148,7 @@ Hostkey fingerprint is \(handler.getHostkey() ?? "nil")
handler.writeToChannel(hostsManager.snippets.first(where: { $0.id == handler.host.startupSnippetID })?.content)
}
} label: {
Label(
handler.connected ? "Disconnect" : "Connect",
systemImage: handler.connected ? "xmark.app.fill" : "power"
)
Label("Connect", systemImage: "power")
}
.disabled(handler.hostInvalid())
}

View File

@@ -11,9 +11,11 @@ import AudioToolbox
struct ShellView: View {
@ObservedObject var handler: SSHHandler
@ObservedObject var hostsManager: HostsManager
@ObservedObject var container = TerminalViewContainer.shared
@State var jellyLoc: (x: Int, y: Int) = (0, 0)
@State var jellyShow: Bool = true
@Environment(\.dismiss) var dismiss
var body: some View {
@@ -22,10 +24,31 @@ struct ShellView: View {
hostsManager.selectedTheme.background.suiColor
.ignoresSafeArea(.all)
ZStack {
ZStack(alignment: .topLeading) {
TerminalController(handler: handler, hostsManager: hostsManager)
// .colorMultiply(Color(red: 0.95, green: 1, blue: 0.95, opacity: 1))
.brightness(hostsManager.settings.filter == .crt ? 0.2 : 0.0)
.onAppear {
let timer = Timer(timeInterval: 0.1, repeats: true) { timer in
DispatchQueue.main.async {
let terminalView = container.sessions[handler.sessionID ?? UUID()]?.terminalView
terminalView?.getTerminal().hideCursor()
jellyLoc = terminalView?.getTerminal().getCursorLocation() ?? (0,0)
jellyShow = terminalView?.getTerminal().buffer.isCursorInViewPort ?? true
}
}
RunLoop.main.add(timer, forMode: .common)
}
Rectangle()
.frame(width: 4.3, height: 12)
.offset(
x: CGFloat(jellyLoc.x)*4.3,
y: CGFloat(jellyLoc.y)*8.66
)
.opacity(jellyShow ? 1 : 0)
.animation(.spring, value: jellyLoc.x)
.animation(.spring, value: jellyLoc.y)
if hostsManager.settings.filter == .crt {
CRTView()
.opacity(0.75)