From 62debc38fb3af26e5467ff47a330ad8683e60662 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Wed, 27 Aug 2025 11:21:46 +0100 Subject: [PATCH] changed how the crt effect and terminal blend, now the colors arent washed out --- ShhShell/Terminal/CRT.metal | 4 +- ShhShell/Terminal/SSHTerminalDelegate.swift | 5 +++ ShhShell/Views/Terminal/ShellView.swift | 43 +++++++++++---------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/ShhShell/Terminal/CRT.metal b/ShhShell/Terminal/CRT.metal index 0e3293f..09f50c4 100644 --- a/ShhShell/Terminal/CRT.metal +++ b/ShhShell/Terminal/CRT.metal @@ -22,12 +22,12 @@ using namespace metal; //scanlines half scanline = 0.5 + 0.5 * sin(uv.y * 1250.0); - scanline *= 0.5; +// scanline *= 0.5; half3 newColor = scanwave*scanline; half alpha = 1 - scanline; - alpha *= 0.5; + alpha *= 1; // half4 output = half4(layer.sample(pos).xyz*newCol, 1); half4 output = half4(color.xyz*newColor*alpha, alpha); diff --git a/ShhShell/Terminal/SSHTerminalDelegate.swift b/ShhShell/Terminal/SSHTerminalDelegate.swift index 2cbc14e..5a74ef5 100644 --- a/ShhShell/Terminal/SSHTerminalDelegate.swift +++ b/ShhShell/Terminal/SSHTerminalDelegate.swift @@ -52,6 +52,10 @@ final class SSHTerminalDelegate: TerminalView, Sendable, @preconcurrency Termina } } + override func cursorStyleChanged(source: Terminal, newStyle: CursorStyle) { + + } + func startFeedLoop() { Task { guard let handler else { return } @@ -59,6 +63,7 @@ final class SSHTerminalDelegate: TerminalView, Sendable, @preconcurrency Termina if let read = handler.readFromChannel() { await MainActor.run { self.feed(text: read) + print(getTerminal().getCursorLocation()) } } else { try? await Task.sleep(nanoseconds: 10_000_000) //10ms diff --git a/ShhShell/Views/Terminal/ShellView.swift b/ShhShell/Views/Terminal/ShellView.swift index 296b33f..b39ee8a 100644 --- a/ShhShell/Views/Terminal/ShellView.swift +++ b/ShhShell/Views/Terminal/ShellView.swift @@ -16,34 +16,35 @@ struct ShellView: View { @Environment(\.dismiss) var dismiss - @State var startTime: Date = .now - var body: some View { NavigationStack { - let time = startTime.timeIntervalSinceNow ZStack { hostsManager.selectedTheme.background.suiColor .ignoresSafeArea(.all) - TerminalController(handler: handler, hostsManager: hostsManager) -// .visualEffect { content, proxy in -// content -// .layerEffect( -// ShaderLibrary.crt( -// .float2(proxy.size), -// .float(time) -// ), -// maxSampleOffset: .zero -// ) -// } -// .blendMode(.screen) - .overlay { - if hostsManager.settings.filter == .crt { - CRTView() - .opacity(0.75) - .allowsHitTesting(false) + ZStack { + TerminalController(handler: handler, hostsManager: hostsManager) + .colorMultiply(Color(red: 0.95, green: 1, blue: 0.95, opacity: 1)) + .colorMultiply(.white) + // .visualEffect { content, proxy in + // content + // .layerEffect( + // ShaderLibrary.crt( + // .float2(proxy.size), + // .float(time) + // ), + // maxSampleOffset: .zero + // ) + // } + .overlay { + if hostsManager.settings.filter == .crt { + CRTView() + .opacity(0.75) + .blendMode(.overlay) + .allowsHitTesting(false) + } } - } + } Group { Color.gray.opacity(0.2)