mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +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")
|
||||
.font(.headline)
|
||||
.monospaced()
|
||||
Button() {
|
||||
showAdder.toggle()
|
||||
} label: {
|
||||
Label("Add", systemImage: "plus.circle.fill")
|
||||
}
|
||||
}
|
||||
ForEach(hostsManager.snippets) { snip in
|
||||
Button(snip.name) {
|
||||
@@ -34,6 +29,14 @@ struct SnippetPicker: View {
|
||||
callback?(snip)
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
Button() {
|
||||
showAdder.toggle()
|
||||
} label: {
|
||||
Label("Add", systemImage: "plus.circle.fill")
|
||||
}
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showAdder) {
|
||||
AddSnippetView(hostsManager: hostsManager)
|
||||
|
||||
@@ -13,6 +13,9 @@ struct ShellTabView: View {
|
||||
|
||||
@ObservedObject var container = TerminalViewContainer.shared
|
||||
@State var selectedID: UUID?
|
||||
var selectedHandler: SSHHandler {
|
||||
container.sessions[selectedID ?? UUID()]?.handler ?? handler!
|
||||
}
|
||||
|
||||
@State var showSnippetPicker: Bool = false
|
||||
|
||||
@@ -63,13 +66,13 @@ struct ShellTabView: View {
|
||||
}
|
||||
Spacer()
|
||||
VStack {
|
||||
Text(container.sessions[selectedID ?? UUID()]?.handler.title ?? handler?.title ?? "")
|
||||
Text(selectedHandler.title)
|
||||
.bold()
|
||||
.foregroundStyle(foreground)
|
||||
.monospaced()
|
||||
.contentTransition(.numericText())
|
||||
if container.sessionIDs.count == 1 {
|
||||
Text(container.sessions[selectedID ?? UUID()]?.handler.host.description ?? handler?.host.description ?? "")
|
||||
Text(selectedHandler.host.description)
|
||||
.bold()
|
||||
.foregroundStyle(foreground)
|
||||
.monospaced()
|
||||
@@ -87,10 +90,24 @@ struct ShellTabView: View {
|
||||
.foregroundStyle(foreground)
|
||||
.popover(isPresented: $showSnippetPicker) {
|
||||
SnippetPicker(hostsManager: hostsManager) {
|
||||
container.sessions[selectedID ?? UUID()]?.handler.writeToChannel($0.content)
|
||||
selectedHandler.writeToChannel($0.content)
|
||||
}
|
||||
.frame(minWidth: 200, minHeight: 300)
|
||||
.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(.vertical, 10)
|
||||
|
||||
Reference in New Issue
Block a user