Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ struct MenuItemView: View {

var hasApps: Bool { !apps.isEmpty }

private var itemName: AttributedString {
let name = item.primaryHost(hostnameSuffix: state.hostnameSuffix)
private var plainItemName: String {
item.primaryHost(hostnameSuffix: state.hostnameSuffix)
}

var formattedName = AttributedString(name)
private var itemName: AttributedString {
var formattedName = AttributedString(plainItemName)
formattedName.foregroundColor = .primary

if let range = formattedName.range(of: ".\(state.hostnameSuffix)", options: .backwards) {
Expand Down Expand Up @@ -134,6 +136,7 @@ struct MenuItemView: View {
.onHover { hovering in
nameIsSelected = hovering
}
.help(plainItemName)
}.buttonStyle(.plain).padding(.trailing, 3)
MenuItemIcons(item: item, wsURL: wsURL)
}
Expand Down Expand Up @@ -223,9 +226,12 @@ struct MenuItemIcons: View {
@State private var webIsSelected: Bool = false

func copyToClipboard() {
let primaryHost = item.primaryHost(hostnameSuffix: state.hostnameSuffix)
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(primaryHost, forType: .string)
NSPasteboard.general.setString(plainItemName, forType: .string)
}

private var plainItemName: String {
item.primaryHost(hostnameSuffix: state.hostnameSuffix)
}

var body: some View {
Expand Down
Loading