mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
fix: preferences panel icons wouldnt show on old macos versions
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user