mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 21:36:17 +00:00
added a menu to copy scrollback, need to strip the excape sequances next
made the snippet adder button always show
This commit is contained in:
@@ -22,11 +22,6 @@ struct SnippetPicker: View {
|
|||||||
Text("No Snippets")
|
Text("No Snippets")
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
.monospaced()
|
.monospaced()
|
||||||
Button() {
|
|
||||||
showAdder.toggle()
|
|
||||||
} label: {
|
|
||||||
Label("Add", systemImage: "plus.circle.fill")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ForEach(hostsManager.snippets) { snip in
|
ForEach(hostsManager.snippets) { snip in
|
||||||
Button(snip.name) {
|
Button(snip.name) {
|
||||||
@@ -34,6 +29,14 @@ struct SnippetPicker: View {
|
|||||||
callback?(snip)
|
callback?(snip)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Section {
|
||||||
|
Button() {
|
||||||
|
showAdder.toggle()
|
||||||
|
} label: {
|
||||||
|
Label("Add", systemImage: "plus.circle.fill")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $showAdder) {
|
.sheet(isPresented: $showAdder) {
|
||||||
AddSnippetView(hostsManager: hostsManager)
|
AddSnippetView(hostsManager: hostsManager)
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ struct ShellTabView: View {
|
|||||||
|
|
||||||
@ObservedObject var container = TerminalViewContainer.shared
|
@ObservedObject var container = TerminalViewContainer.shared
|
||||||
@State var selectedID: UUID?
|
@State var selectedID: UUID?
|
||||||
|
var selectedHandler: SSHHandler {
|
||||||
|
container.sessions[selectedID ?? UUID()]?.handler ?? handler!
|
||||||
|
}
|
||||||
|
|
||||||
@State var showSnippetPicker: Bool = false
|
@State var showSnippetPicker: Bool = false
|
||||||
|
|
||||||
@@ -63,13 +66,13 @@ struct ShellTabView: View {
|
|||||||
}
|
}
|
||||||
Spacer()
|
Spacer()
|
||||||
VStack {
|
VStack {
|
||||||
Text(container.sessions[selectedID ?? UUID()]?.handler.title ?? handler?.title ?? "")
|
Text(selectedHandler.title)
|
||||||
.bold()
|
.bold()
|
||||||
.foregroundStyle(foreground)
|
.foregroundStyle(foreground)
|
||||||
.monospaced()
|
.monospaced()
|
||||||
.contentTransition(.numericText())
|
.contentTransition(.numericText())
|
||||||
if container.sessionIDs.count == 1 {
|
if container.sessionIDs.count == 1 {
|
||||||
Text(container.sessions[selectedID ?? UUID()]?.handler.host.description ?? handler?.host.description ?? "")
|
Text(selectedHandler.host.description)
|
||||||
.bold()
|
.bold()
|
||||||
.foregroundStyle(foreground)
|
.foregroundStyle(foreground)
|
||||||
.monospaced()
|
.monospaced()
|
||||||
@@ -87,10 +90,24 @@ struct ShellTabView: View {
|
|||||||
.foregroundStyle(foreground)
|
.foregroundStyle(foreground)
|
||||||
.popover(isPresented: $showSnippetPicker) {
|
.popover(isPresented: $showSnippetPicker) {
|
||||||
SnippetPicker(hostsManager: hostsManager) {
|
SnippetPicker(hostsManager: hostsManager) {
|
||||||
container.sessions[selectedID ?? UUID()]?.handler.writeToChannel($0.content)
|
selectedHandler.writeToChannel($0.content)
|
||||||
}
|
}
|
||||||
|
.frame(minWidth: 200, minHeight: 300)
|
||||||
.modifier(presentationCompactPopover())
|
.modifier(presentationCompactPopover())
|
||||||
}
|
}
|
||||||
|
Menu {
|
||||||
|
Button() {
|
||||||
|
UIPasteboard.general.string = selectedHandler.scrollback.joined()
|
||||||
|
Haptic.success.trigger()
|
||||||
|
} label: {
|
||||||
|
Label("Copy Scrollback", systemImage: "document.on.document")
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "ellipsis")
|
||||||
|
.resizable().scaledToFit()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
}
|
||||||
|
.foregroundStyle(foreground)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 10)
|
.padding(.horizontal, 10)
|
||||||
.padding(.vertical, 10)
|
.padding(.vertical, 10)
|
||||||
|
|||||||
Reference in New Issue
Block a user