From 1853bb957149cb0d85b586a4e4ff9ef32f79c2bb Mon Sep 17 00:00:00 2001 From: Pei-Tang Huang Date: Thu, 21 May 2026 14:33:28 +0800 Subject: [PATCH] ui: use cable.connector SF Symbol for USB toolbar item The USB toolbar item used a bundled PNG (Toolbar USB) whose stroke weight and overall size visibly differed from the surrounding SF Symbols (cursorarrow.rays, opticaldisc, folder.badge.person.crop, rectangle.on.rectangle, etc.). The mismatch is especially noticeable in the floating capsule toolbar on macOS 26 (Tahoe). Replace the icon with the system SF Symbol cable.connector when available (iOS 15 / macOS 12 / visionOS 1, the SF Symbols 3 release where cable.connector was introduced), and keep the existing PNG as a fallback for older releases. Co-authored-by: Claude Opus 4.7 --- Platform/iOS/VMToolbarUSBMenuView.swift | 4 ++++ .../macOS/Display/VMDisplayWindowController.swift | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Platform/iOS/VMToolbarUSBMenuView.swift b/Platform/iOS/VMToolbarUSBMenuView.swift index 9061bafbe3..8435ab8998 100644 --- a/Platform/iOS/VMToolbarUSBMenuView.swift +++ b/Platform/iOS/VMToolbarUSBMenuView.swift @@ -41,6 +41,10 @@ struct VMToolbarUSBMenuView: View { } label: { if session.isUsbBusy { Spinner(size: .regular) + } else if #available(iOS 15, macOS 12, visionOS 1, *) { + // cable.connector ships in SF Symbols 3, so it matches the + // stroke weight and sizing of the surrounding toolbar items. + Label("USB", systemImage: "cable.connector") } else { Label("USB", image: "Toolbar USB") } diff --git a/Platform/macOS/Display/VMDisplayWindowController.swift b/Platform/macOS/Display/VMDisplayWindowController.swift index 9ed771f3ab..cb42d66b22 100644 --- a/Platform/macOS/Display/VMDisplayWindowController.swift +++ b/Platform/macOS/Display/VMDisplayWindowController.swift @@ -220,15 +220,27 @@ class VMDisplayWindowController: NSWindowController, UTMVirtualMachineDelegate { window!.recalculateKeyViewLoop() setupStopButtonMenu() setupMainMenu() + setupToolbarIcons() if vm.state == .stopped { enterSuspended(isBusy: false) } else { enterLive() } - + super.windowDidLoad() } + + private func setupToolbarIcons() { + // cable.connector ships in SF Symbols 3 (macOS 12+); use it so the + // USB toolbar item visually matches the surrounding system symbols. + // Older systems fall back to the bundled "Toolbar USB" template + // image from the nib. + if #available(macOS 12, *) { + usbToolbarItem.image = NSImage(systemSymbolName: "cable.connector", + accessibilityDescription: usbToolbarItem.label) + } + } public func requestAutoStart(options: UTMVirtualMachineStartOptions = []) { guard shouldAutoStartVM else {