Skip to content

Commit 106f994

Browse files
committed
Use non-monospaced text on macOS Ventura due to bugs in macOS/SwiftUI
_closes #1122
1 parent 24143af commit 106f994

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Sources/AppBundle/MenuBar.swift

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,20 @@ struct MonospacedText: View {
6565
init(_ text: String) { self.text = text }
6666

6767
var body: some View {
68-
let renderer = ImageRenderer(
69-
content: Text(text)
70-
.font(.system(.largeTitle, design: .monospaced))
71-
.foregroundStyle(colorScheme == .light ? Color.black : Color.white)
72-
)
73-
if let cgImage = renderer.cgImage {
74-
// Using scale: 1 results in a blurry image for unknown reasons
75-
Image(cgImage, scale: 2, label: Text(text))
68+
if #available(macOS 14, *) { // https://github.com/nikitabobko/AeroSpace/issues/1122
69+
let renderer = ImageRenderer(
70+
content: Text(text)
71+
.font(.system(.largeTitle, design: .monospaced))
72+
.foregroundStyle(colorScheme == .light ? Color.black : Color.white)
73+
)
74+
if let cgImage = renderer.cgImage {
75+
// Using scale: 1 results in a blurry image for unknown reasons
76+
Image(cgImage, scale: 2, label: Text(text))
77+
} else {
78+
// In case image can't be rendered fallback to plain text
79+
Text(text)
80+
}
7681
} else {
77-
// In case image can't be rendered fallback to plain text
7882
Text(text)
7983
}
8084
}

0 commit comments

Comments
 (0)