mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Update AppIcon setting
This commit is contained in:
parent
1bfce0c19a
commit
8b633b3ff5
5 changed files with 243 additions and 33 deletions
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import SwiftUI
|
||||
import AppKit
|
||||
import Defaults
|
||||
|
||||
struct AppIcons {
|
||||
|
||||
|
|
@ -58,3 +59,18 @@ func AppIconAsNSImage(for bundleID: String) -> NSImage? {
|
|||
return nil
|
||||
}
|
||||
|
||||
func applySelectedAppIcon() {
|
||||
let customIcons = Defaults[.customAppIcons]
|
||||
if let selectedID = Defaults[.selectedAppIconID],
|
||||
let icon = customIcons.first(where: { $0.id.uuidString == selectedID }),
|
||||
let image = NSImage(contentsOf: icon.fileURL) {
|
||||
NSApp.applicationIconImage = image
|
||||
return
|
||||
}
|
||||
|
||||
let fallbackName = Bundle.main.iconFileName ?? "AppIcon"
|
||||
if let image = NSImage(named: fallbackName) {
|
||||
NSApp.applicationIconImage = image
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue