diff --git a/Loop/LoopApp.swift b/Loop/LoopApp.swift index 2e455157..d51c10df 100644 --- a/Loop/LoopApp.swift +++ b/Loop/LoopApp.swift @@ -95,7 +95,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { // Check & ask for accessibility access PermissionsManager.Accessibility.requestAccess() - iconManager.restoreCurrentAppIcon() + iconManager.refreshCurrentAppIcon() if Defaults[.windowSnapping] { SnappingManager.shared.addObservers() diff --git a/Loop/Managers/IconManager.swift b/Loop/Managers/IconManager.swift index 8a949f75..0598b857 100644 --- a/Loop/Managers/IconManager.swift +++ b/Loop/Managers/IconManager.swift @@ -52,20 +52,18 @@ class IconManager { } func setAppIcon(to icon: Icon) { - NSWorkspace.shared.setIcon(NSImage(named: icon.name), forFile: Bundle.main.bundlePath, options: []) - NSApp.applicationIconImage = NSImage(named: icon.name) + Defaults[.currentIcon] = icon.name + self.refreshCurrentAppIcon() let alert = NSAlert() alert.messageText = "\(Bundle.main.appName)" alert.informativeText = "Current icon is now \(nameWithoutPrefix(name: icon.name))!" alert.icon = NSImage(named: icon.name) alert.runModal() - - Defaults[.currentIcon] = icon.name } // This function is run at startup to set the current icon to the user's set icon. - func restoreCurrentAppIcon() { + func refreshCurrentAppIcon() { NSWorkspace.shared.setIcon(NSImage(named: Defaults[.currentIcon]), forFile: Bundle.main.bundlePath, options: []) NSApp.applicationIconImage = NSImage(named: Defaults[.currentIcon]) }