macos/ios: use cable.connector SF Symbol for USB toolbar item#7718
Conversation
| // Use the SF Symbol introduced in macOS 14 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 14, *) { |
There was a problem hiding this comment.
macOS 14? Either that means iOS wrong (iOS 17 is the aligned release) or macOS is wrong. Can you check by testing?
There was a problem hiding this comment.
You're right, thanks for catching this — both versions were wrong.
cable.connector is actually an SF Symbols 3 symbol (iOS 15 / macOS 12 / tvOS 15 / watchOS 8 / visionOS 1), not SF Symbols 5 as I had mistakenly assumed. The metadata in SFSafeSymbols (which is autogenerated from Apple's SF Symbols catalog) lists it under the @available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, visionOS 1.0, *) 3.0 extension:
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, visionOS 1.0, *)
public extension SFSymbol {
...
static var cableConnector: SFSymbol { .init(rawValue: "cable.connector") }
I've tightened the checks to:
Platform/macOS/Display/VMDisplayWindowController.swift:#available(macOS 12, *)Platform/iOS/VMToolbarUSBMenuView.swift:#available(iOS 15, macOS 12, visionOS 1, *)
so the SF Symbol path now covers every deployment target down to the documented minimum and the bundled Toolbar USB PNG only renders on iOS 14 / macOS 11.3. Force-pushed to the same branch.
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 <noreply@anthropic.com>
b1adae0 to
1853bb9
Compare
Summary
The USB toolbar item was the only icon in the VM session window using a bundled bitmap (
Toolbar USB.imageset) instead of an SF Symbol. Its stroke weight and overall sizing visibly differed from the surrounding system symbols (cursorarrow.rays,arrow.up.left.and.arrow.down.right,opticaldisc,folder.badge.person.crop,rectangle.on.rectangle, …). The mismatch is especially noticeable on the floating capsule toolbar introduced in macOS 26 (Tahoe), where the lighter USB stroke sticks out next to its neighbours.Changes
Platform/macOS/Display/VMDisplayWindowController.swift— overrideusbToolbarItem.imagewithNSImage(systemSymbolName: "cable.connector", …)on macOS 14+ inside a newsetupToolbarIcons()helper called fromwindowDidLoad. Older macOS releases keep using the bundled template image from the nib.Platform/iOS/VMToolbarUSBMenuView.swift— useLabel("USB", systemImage: "cable.connector")on iOS 17 / macOS 14 / visionOS 1 or later. Older releases still fall back toLabel("USB", image: "Toolbar USB").The
Toolbar USB.imagesetbitmap is intentionally kept as a fallback for the deployment targets that don't havecable.connector(iOS 14–16, macOS 11.3–13).Tested on
Verified
cursorarrow.rays,arrow.up.left.and.arrow.down.right,opticaldisc,folder.badge.person.crop,rectangle.on.rectangle) in the floating capsule toolbar on macOS 26 Tahoe — see the Before / After comparison above.Not verified (out of scope for this change)
imageon the existingusbToolbarItem/ SwiftUILabel; no IBAction, target, menu, orenterSuspendedwiring is touched, so functional behaviour should be unaffected.Toolbar USBtemplate image from the nib, so behaviour on those releases should be identical to before.#available(iOS 17, macOS 14, visionOS 1, *)and falls back to the same bundled image on older OSes.Notes
Code is AI-assisted. The commit carries
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>.I have read the AI Contribution Guidelines and can attest that I have followed each item to the best of my ability.