diff --git a/docs/Contributors.md b/docs/Contributors.md index bcfb3126..1c0f0345 100644 --- a/docs/Contributors.md +++ b/docs/Contributors.md @@ -53,6 +53,7 @@ They helped [localize the app](https://poeditor.com/join/project/8AOEZ0eAZE): * Ameng * Anders * Andrew Vader +* antoon334 * Anurag Roy * anushree b * Arman diff --git a/src/ui/preferences-window/LabelAndControl.swift b/src/ui/preferences-window/LabelAndControl.swift index c2a2934c..84bf613a 100644 --- a/src/ui/preferences-window/LabelAndControl.swift +++ b/src/ui/preferences-window/LabelAndControl.swift @@ -261,6 +261,7 @@ class LabelAndControl: NSObject { } if #available(macOS 11.0, *) { if let preference = preference as? SfSymbolMacroPreference, + // each systemSymbolName has a different minimum macOS requirements; we need to make sure it exists let symbolImage = NSImage(systemSymbolName: preference.symbolName, accessibilityDescription: nil) { button.setImage(symbolImage, forSegment: i) } diff --git a/src/ui/preferences-window/PreferencesWindow.swift b/src/ui/preferences-window/PreferencesWindow.swift index 926ba941..46e15400 100644 --- a/src/ui/preferences-window/PreferencesWindow.swift +++ b/src/ui/preferences-window/PreferencesWindow.swift @@ -67,9 +67,14 @@ class PreferencesWindow: NSWindow, NSToolbarDelegate { let item = NSToolbarItem(itemIdentifier: identifier) item.label = label if #available(macOS 11.0, *) { - item.image = NSImage(systemSymbolName: image, accessibilityDescription: nil) - } else { - item.image = NSImage.initTemplateCopy(image) + // each systemSymbolName has a different minimum macOS requirements; we need to make sure it exists + if let image = NSImage(systemSymbolName: image, accessibilityDescription: nil) { + item.image = image + } + } + // it seems that new instances of NSToolbarItems have their image set to a 1x1 image + if item.image == nil || item.image!.size == .init(width: 1, height: 1) { + item.image = NSImage.initTemplateCopy(id) item.maxSize = .init(width: 22, height: 22) } item.target = self