Update AppIcon setting

This commit is contained in:
Hariharan Mudaliar 2026-01-28 22:45:53 +05:30
commit 8b633b3ff5
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
5 changed files with 243 additions and 33 deletions

View file

@ -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
}
}