mirror of
https://github.com/utmapp/UTM.git
synced 2026-10-11 21:59:56 +00:00
settings: match the add-device menu to the sidebar on macOS 26
On macOS 26 and later, the borderless button menu style draws the Devices "New…" entry as a compact pull-down: smaller text, an untinted icon, a chevron, and a text column that does not line up with the other sidebar rows. Only the button menu style combined with the plain button style renders the label like the neighbouring rows, so use that on macOS 26 and keep the existing style on older releases and on iOS. Assisted-by: Claude:claude-fable-5-1
This commit is contained in:
@@ -85,7 +85,24 @@ struct VMSettingsAddDeviceMenuView: View {
|
||||
} label: {
|
||||
Label("New…", systemImage: "plus")
|
||||
}.help("Add a new device.")
|
||||
.menuStyle(.borderlessButton)
|
||||
.addDeviceMenuStyle()
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
/// Style the "New…" menu so it matches the other entries in the settings sidebar.
|
||||
@ViewBuilder
|
||||
func addDeviceMenuStyle() -> some View {
|
||||
#if os(macOS)
|
||||
if #available(macOS 26, *) {
|
||||
// .borderlessButton renders as a compact pull-down that no longer matches the sidebar rows
|
||||
self.menuStyle(.button).buttonStyle(.plain)
|
||||
} else {
|
||||
self.menuStyle(.borderlessButton)
|
||||
}
|
||||
#else
|
||||
self.menuStyle(.borderlessButton)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ struct VMAppleSettingsAddDeviceMenuView: View {
|
||||
} label: {
|
||||
Label("New…", systemImage: "plus")
|
||||
}.help("Add a new device.")
|
||||
.menuStyle(.borderlessButton)
|
||||
.addDeviceMenuStyle()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user