From 09a6e5a029b72b1ca1203c4180a837e3d146a26e Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Fri, 29 Aug 2025 23:38:31 +0100 Subject: [PATCH] hardcoded a wip jellycursor --- ShhShell.xcodeproj/project.pbxproj | 4 +++ ShhShell/SSH/SSHHandler.swift | 1 + ShhShell/Terminal/SSHTerminalDelegate.swift | 11 +++++++- ShhShell/Views/Hosts/ConnectionView.swift | 5 +--- ShhShell/Views/Terminal/ShellView.swift | 29 ++++++++++++++++++--- 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/ShhShell.xcodeproj/project.pbxproj b/ShhShell.xcodeproj/project.pbxproj index c8c0748..d7bed58 100644 --- a/ShhShell.xcodeproj/project.pbxproj +++ b/ShhShell.xcodeproj/project.pbxproj @@ -81,6 +81,7 @@ A98554632E0587DF009051BD /* HostsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98554622E0587DF009051BD /* HostsView.swift */; }; A98CAB442E4229F7005E4C42 /* HostSymbolPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98CAB432E4229F7005E4C42 /* HostSymbolPicker.swift */; }; A9921DE12E5F5710009F72A8 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9921DE02E5F5710009F72A8 /* WelcomeView.swift */; }; + A9921FFF2E61D537009F72A8 /* libssh2.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9921FFE2E61D537009F72A8 /* libssh2.xcframework */; }; A994D64A2E5C94E200672395 /* ShaderTestingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A994D6492E5C94E200672395 /* ShaderTestingView.swift */; }; A9A2F4F62E3001D300D0AE9B /* AddSnippetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A2F4F52E3001D300D0AE9B /* AddSnippetView.swift */; }; A9B1E5852E5F8E86009309E5 /* WelcomeChunk.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9B1E5842E5F8E86009309E5 /* WelcomeChunk.swift */; }; @@ -224,6 +225,7 @@ A98554622E0587DF009051BD /* HostsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostsView.swift; sourceTree = ""; }; A98CAB432E4229F7005E4C42 /* HostSymbolPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostSymbolPicker.swift; sourceTree = ""; }; A9921DE02E5F5710009F72A8 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = ""; }; + A9921FFE2E61D537009F72A8 /* libssh2.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = libssh2.xcframework; path = ../blink/xcfs/.build/artifacts/xcfs/libssh2/libssh2.xcframework; sourceTree = SOURCE_ROOT; }; A994D6492E5C94E200672395 /* ShaderTestingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShaderTestingView.swift; sourceTree = ""; }; A9A2F4F52E3001D300D0AE9B /* AddSnippetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddSnippetView.swift; sourceTree = ""; }; A9B1E5842E5F8E86009309E5 /* WelcomeChunk.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeChunk.swift; sourceTree = ""; }; @@ -261,6 +263,7 @@ A95FAA542DF4B62900DE2F5A /* LibSSH.xcframework in Frameworks */, A9E78F422E58BD770079F3CC /* SwiftTerm in Frameworks */, A93143BE2DF4D0B300FCD5DB /* libpthread.tbd in Frameworks */, + A9921FFF2E61D537009F72A8 /* libssh2.xcframework in Frameworks */, A9083E402DF2226F0042906E /* libz.tbd in Frameworks */, A95FAA562DF4B62A00DE2F5A /* openssl.xcframework in Frameworks */, ); @@ -630,6 +633,7 @@ A9083E3F2DF2225A0042906E /* libz.tbd */, A95FAA502DF4B62100DE2F5A /* LibSSH.xcframework */, A95FAA512DF4B62100DE2F5A /* openssl.xcframework */, + A9921FFE2E61D537009F72A8 /* libssh2.xcframework */, ); name = Frameworks; sourceTree = ""; diff --git a/ShhShell/SSH/SSHHandler.swift b/ShhShell/SSH/SSHHandler.swift index 1835afe..2a697eb 100644 --- a/ShhShell/SSH/SSHHandler.swift +++ b/ShhShell/SSH/SSHHandler.swift @@ -7,6 +7,7 @@ import Foundation import LibSSH +import libssh2 import OSLog import SwiftUI import SwiftTerm diff --git a/ShhShell/Terminal/SSHTerminalDelegate.swift b/ShhShell/Terminal/SSHTerminalDelegate.swift index 3d1b4da..c4deb31 100644 --- a/ShhShell/Terminal/SSHTerminalDelegate.swift +++ b/ShhShell/Terminal/SSHTerminalDelegate.swift @@ -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() { diff --git a/ShhShell/Views/Hosts/ConnectionView.swift b/ShhShell/Views/Hosts/ConnectionView.swift index c9066eb..40ea7c5 100644 --- a/ShhShell/Views/Hosts/ConnectionView.swift +++ b/ShhShell/Views/Hosts/ConnectionView.swift @@ -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()) } diff --git a/ShhShell/Views/Terminal/ShellView.swift b/ShhShell/Views/Terminal/ShellView.swift index ed492ed..1ca9628 100644 --- a/ShhShell/Views/Terminal/ShellView.swift +++ b/ShhShell/Views/Terminal/ShellView.swift @@ -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)