added traffliclights to make the traffic lights perfect, red yellow done

green wip
clean up on the terminal view: add background and reorg the fiel and add traffic lights
add bg to all the terminal related stuff
This commit is contained in:
neon443
2025-07-04 10:47:27 +01:00
parent a9df89eae2
commit ecfd997487
5 changed files with 197 additions and 100 deletions

View File

@@ -49,6 +49,7 @@
A96C6B022E0C49E800F377FE /* CenteredLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A96C6B012E0C49E800F377FE /* CenteredLabel.swift */; };
A96C90A12E12B87A00724253 /* TextBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = A96C90A02E12B87900724253 /* TextBox.swift */; };
A96C90A32E12D53B00724253 /* KeyType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A96C90A22E12D53900724253 /* KeyType.swift */; };
A9835C3C2E17CCA500969508 /* TrafficLights.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9835C3B2E17CCA500969508 /* TrafficLights.swift */; };
A98554552E05535F009051BD /* KeyManagerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98554542E05535F009051BD /* KeyManagerView.swift */; };
A98554592E0553AA009051BD /* KeyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98554582E0553AA009051BD /* KeyManager.swift */; };
A985545D2E055D4D009051BD /* ConnectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A985545C2E055D4D009051BD /* ConnectionView.swift */; };
@@ -154,6 +155,7 @@
A96C6B012E0C49E800F377FE /* CenteredLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CenteredLabel.swift; sourceTree = "<group>"; };
A96C90A02E12B87900724253 /* TextBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextBox.swift; sourceTree = "<group>"; };
A96C90A22E12D53900724253 /* KeyType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyType.swift; sourceTree = "<group>"; };
A9835C3B2E17CCA500969508 /* TrafficLights.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrafficLights.swift; sourceTree = "<group>"; };
A98554542E05535F009051BD /* KeyManagerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyManagerView.swift; sourceTree = "<group>"; };
A98554582E0553AA009051BD /* KeyManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyManager.swift; sourceTree = "<group>"; };
A985545C2E055D4D009051BD /* ConnectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionView.swift; sourceTree = "<group>"; };
@@ -355,6 +357,7 @@
A93143C52DF61FE300FCD5DB /* ViewModifiers.swift */,
A96C90A02E12B87900724253 /* TextBox.swift */,
A9DA97722E0D40C100142DDC /* HostSymbolPreview.swift */,
A9835C3B2E17CCA500969508 /* TrafficLights.swift */,
);
path = Misc;
sourceTree = "<group>";
@@ -604,6 +607,7 @@
A9D819292E0E904200442D38 /* Theme.swift in Sources */,
A9D8192D2E0E9EB500442D38 /* ThemeManagerView.swift in Sources */,
A9FD375D2E143D7E005319A8 /* KeyStoreError.swift in Sources */,
A9835C3C2E17CCA500969508 /* TrafficLights.swift in Sources */,
A93143C62DF61FE300FCD5DB /* ViewModifiers.swift in Sources */,
A98554632E0587DF009051BD /* HostsView.swift in Sources */,
A96C6A8A2E0C0B1100F377FE /* SSHState.swift in Sources */,

View File

@@ -0,0 +1,83 @@
//
// TrafficLights.swift
// ShhShell
//
// Created by neon443 on 04/07/2025.
//
import SwiftUI
struct TrafficLightRed: View {
var body: some View {
ZStack {
Image(systemName: "circle.fill")
.resizable().scaledToFit()
.foregroundStyle(.red)
Image(systemName: "xmark")
.resizable().scaledToFit()
.bold()
.scaleEffect(0.6)
.foregroundStyle(
ColorCodable(
red: 0.5490196078,
green: 0.1019607843,
blue: 0.0588235294
).stColor.suiColor
)
}
}
}
struct TrafficLightYellow: View {
var body: some View {
ZStack(alignment: .center) {
Image(systemName: "circle.fill")
.resizable().scaledToFit()
.foregroundStyle(.yellow)
Image(systemName: "minus")
.resizable().scaledToFit()
.bold()
.scaleEffect(0.6)
.foregroundStyle(
ColorCodable(
red: 0.5803921569,
green: 0.3411764706,
blue: 0.0980392157
).stColor.suiColor
)
}
}
}
struct TrafficLightGreen: View {
var body: some View {
ZStack(alignment: .center) {
Image(systemName: "circle.fill")
.resizable().scaledToFit()
.symbolRenderingMode(.palette)
.foregroundStyle(.green)
Rectangle()
.foregroundStyle(
ColorCodable(
red: 0.1529411765,
green: 0.3843137255,
blue: 0.1176470588
).stColor.suiColor
)
.scaleEffect(0.6)
.aspectRatio(1, contentMode: .fit)
}
}
}
#Preview {
Group {
HStack {
TrafficLightRed()
TrafficLightYellow()
TrafficLightGreen()
}
}
.frame(width: 150, height: 50)
.scaleEffect(4.9)
}

View File

@@ -19,8 +19,8 @@ final class SSHTerminalDelegate: TerminalView, Sendable, @preconcurrency Termina
self.handler = handler
self.hostsManager = hostsManager
print(getTerminal().backgroundColor)
print(getTerminal().foregroundColor)
print(getTerminal().backgroundColor.colorCodable)
print(getTerminal().foregroundColor.colorCodable)
applySelectedTheme()

View File

@@ -16,9 +16,18 @@ struct ShellTabView: View {
@Environment(\.dismiss) var dismiss
var foreground: Color { hostsManager.selectedTheme.foreground.suiColor }
var ansi7: Color { hostsManager.selectedTheme.ansi[6].suiColor.opacity(0.7) }
var background: Color { hostsManager.selectedTheme.background.suiColor }
var body: some View {
ZStack {
background
.ignoresSafeArea(.all)
GeometryReader { geo in
VStack {
let oneTabWidth = max(60, (geo.size.width)/CGFloat(container.sessionIDs.count))
HStack(alignment: .center, spacing: 10) {
Button() {
for session in container.sessions.values {
@@ -44,22 +53,29 @@ struct ShellTabView: View {
.yellow
)
}
Button() {
print("get out of fullscreen idk??")
} label: {
Image(systemName: "minus.circle.fill")
.resizable().scaledToFit()
.symbolRenderingMode(.palette)
.foregroundStyle(
ColorCodable(red: 0.5764705882, green: 0.5333333333, blue: 0.2784313725).stColor.suiColor,
.yellow
)
}
Spacer()
Text(container.sessions[selectedID ?? UUID()]?.handler.title ?? "title")
Spacer()
}
.frame(height: 30)
.padding(10)
.padding(.horizontal)
let oneTabWidth = max(60, (geo.size.width-35)/CGFloat(container.sessionIDs.count))
HStack(alignment: .center, spacing: 0) {
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 0) {
ForEach(container.sessionIDs, id: \.self) { id in
let selected = selectedID == id
let foreground = hostsManager.selectedTheme.foreground.suiColor
let ansi7 = hostsManager.selectedTheme.ansi[6].suiColor.opacity(0.7)
let background = hostsManager.selectedTheme.background.suiColor
let selected: Bool = selectedID == id
ZStack {
Rectangle()
.fill(selected ? ansi7 : background)
@@ -79,22 +95,12 @@ struct ShellTabView: View {
}
}
.frame(width: oneTabWidth)
.ignoresSafeArea(.all)
.onTapGesture {
withAnimation { selectedID = id }
}
}
}
}
Button() {
dismiss()
} label: {
Image(systemName: "arrow.down.right.and.arrow.up.left")
.resizable().scaledToFit()
}
.buttonStyle(.plain)
.frame(width: 30)
.padding(.horizontal, 2.5)
}
.frame(height: 30)
.onAppear {
@@ -107,6 +113,7 @@ struct ShellTabView: View {
}
}
//the acc terminal lol
if let selectedID,
let session = container.sessions[selectedID] {
ShellView(
@@ -135,6 +142,7 @@ struct ShellTabView: View {
}
}
}
}
#Preview {
ShellTabView(

View File

@@ -18,6 +18,8 @@ struct ShellView: View {
var body: some View {
NavigationStack {
ZStack {
hostsManager.selectedTheme.background.suiColor
.ignoresSafeArea(.all)
TerminalController(handler: handler, hostsManager: hostsManager)
.onAppear {
if let sessionID = handler.sessionID {