ui: 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.
b1adae0 to
1853bb9
Compare
|
Hi, we've recently updated |
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. Assisted-by: Claude:claude-opus-4-7
1853bb9 to
9bf989e
Compare
|
Thanks for the heads-up. I've rebased onto
PTAL when you have a moment. |
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 12+ inside a newsetupToolbarIcons()helper called fromwindowDidLoad. Older macOS releases (macOS 11.3) keep using the bundled template image from the nib.Platform/iOS/VMToolbarUSBMenuView.swift— useLabel("USB", systemImage: "cable.connector")on iOS 15 / macOS 12 / visionOS 1 or later. Older releases (iOS 14) still fall back toLabel("USB", image: "Toolbar USB").cable.connectorwas introduced in SF Symbols 3, so the symbol path covers every deployment target down to the documented minimum and the bundledToolbar USBPNG only renders on iOS 14 / macOS 11.3.Testing
Testing: Tested by a human on MacBook Pro M1 Max, macOS 26.5 (Tahoe). The author acknowledges that this change has been tested and/or reviewed by a human in accordance with UTM's AI contribution guidelines.
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 that release should be identical to before.#available(iOS 15, macOS 12, visionOS 1, *)and falls back to the same bundled image on iOS 14.Notes
Code is AI-assisted. The commit carries
Assisted-by: Claude:claude-opus-4-7per UTM's attribution policy.I have read the AI contribution guidelines and have followed them to the best of my ability.