mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 05:19:13 +00:00
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:
@@ -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 */,
|
||||
|
||||
83
ShhShell/Views/Misc/TrafficLights.swift
Normal file
83
ShhShell/Views/Misc/TrafficLights.swift
Normal 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)
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -16,119 +16,127 @@ 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 {
|
||||
GeometryReader { geo in
|
||||
VStack {
|
||||
HStack(alignment: .center, spacing: 10) {
|
||||
Button() {
|
||||
for session in container.sessions.values {
|
||||
session.handler.disconnect()
|
||||
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 {
|
||||
session.handler.disconnect()
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.resizable().scaledToFit()
|
||||
.symbolRenderingMode(.palette)
|
||||
.foregroundStyle(
|
||||
ColorCodable(red: 0.5411764706, green: 0, blue: 0).stColor.suiColor,
|
||||
.red
|
||||
)
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.resizable().scaledToFit()
|
||||
.symbolRenderingMode(.palette)
|
||||
.foregroundStyle(
|
||||
ColorCodable(red: 0.5411764706, green: 0, blue: 0).stColor.suiColor,
|
||||
.red
|
||||
)
|
||||
Button() {
|
||||
dismiss()
|
||||
} label: {
|
||||
Image(systemName: "minus.circle.fill")
|
||||
.resizable().scaledToFit()
|
||||
.symbolRenderingMode(.palette)
|
||||
.foregroundStyle(
|
||||
ColorCodable(red: 0.5764705882, green: 0.5333333333, blue: 0.2784313725).stColor.suiColor,
|
||||
.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()
|
||||
}
|
||||
Button() {
|
||||
dismiss()
|
||||
} 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)
|
||||
|
||||
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
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(selected ? ansi7 : background)
|
||||
HStack {
|
||||
Spacer()
|
||||
VStack {
|
||||
Text(container.sessions[id]!.handler.title)
|
||||
.monospaced()
|
||||
.foregroundStyle(foreground)
|
||||
.bold(selected)
|
||||
Text(container.sessions[id]!.handler.host.description)
|
||||
.foregroundStyle(foreground.opacity(0.7))
|
||||
.monospaced()
|
||||
.font(.caption)
|
||||
.frame(height: 30)
|
||||
.padding(.horizontal)
|
||||
|
||||
HStack(alignment: .center, spacing: 0) {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 0) {
|
||||
ForEach(container.sessionIDs, id: \.self) { id in
|
||||
let selected: Bool = selectedID == id
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(selected ? ansi7 : background)
|
||||
HStack {
|
||||
Spacer()
|
||||
VStack {
|
||||
Text(container.sessions[id]!.handler.title)
|
||||
.monospaced()
|
||||
.foregroundStyle(foreground)
|
||||
.bold(selected)
|
||||
Text(container.sessions[id]!.handler.host.description)
|
||||
.foregroundStyle(foreground.opacity(0.7))
|
||||
.monospaced()
|
||||
.font(.caption)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.frame(width: oneTabWidth)
|
||||
.ignoresSafeArea(.all)
|
||||
.onTapGesture {
|
||||
withAnimation { selectedID = id }
|
||||
.frame(width: oneTabWidth)
|
||||
.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 {
|
||||
if selectedID == nil {
|
||||
if let handler {
|
||||
selectedID = handler.sessionID
|
||||
} else {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let selectedID,
|
||||
let session = container.sessions[selectedID] {
|
||||
ShellView(
|
||||
handler: session.handler,
|
||||
hostsManager: hostsManager
|
||||
)
|
||||
.onDisappear {
|
||||
if !checkShell(session.handler.state) {
|
||||
if let lastSession = container.sessionIDs.last {
|
||||
withAnimation { self.selectedID = lastSession }
|
||||
.frame(height: 30)
|
||||
.onAppear {
|
||||
if selectedID == nil {
|
||||
if let handler {
|
||||
selectedID = handler.sessionID
|
||||
} else {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
.id(selectedID)
|
||||
.transition(.opacity)
|
||||
} else {
|
||||
if let handler {
|
||||
ShellView(handler: handler, hostsManager: hostsManager)
|
||||
|
||||
//the acc terminal lol
|
||||
if let selectedID,
|
||||
let session = container.sessions[selectedID] {
|
||||
ShellView(
|
||||
handler: session.handler,
|
||||
hostsManager: hostsManager
|
||||
)
|
||||
.onDisappear {
|
||||
if !checkShell(session.handler.state) {
|
||||
if let lastSession = container.sessionIDs.last {
|
||||
withAnimation { self.selectedID = lastSession }
|
||||
} else {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
.id(selectedID)
|
||||
.transition(.opacity)
|
||||
} else {
|
||||
Text("No SSH Handler")
|
||||
if let handler {
|
||||
ShellView(handler: handler, hostsManager: hostsManager)
|
||||
} else {
|
||||
Text("No SSH Handler")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user