mirror of
https://github.com/saymrwulf/KnowledgeRefinery.git
synced 2026-05-14 20:47:51 +00:00
Fix Dock icon not loading — move to onAppear
NSApp.applicationIconImage set in init() was too early; the app wasn't fully initialized yet. Moved to onAppear where NSApp is ready.
This commit is contained in:
parent
38a99476d6
commit
e6246286fb
1 changed files with 9 additions and 6 deletions
|
|
@ -13,12 +13,6 @@ struct KnowledgeRefineryApp: App {
|
||||||
init() {
|
init() {
|
||||||
// Ensure the app appears in the Dock and can become frontmost
|
// Ensure the app appears in the Dock and can become frontmost
|
||||||
NSApplication.shared.setActivationPolicy(.regular)
|
NSApplication.shared.setActivationPolicy(.regular)
|
||||||
|
|
||||||
// Set custom Dock icon from bundled .icns
|
|
||||||
if let iconURL = Bundle.module.url(forResource: "AppIcon", withExtension: "icns"),
|
|
||||||
let icon = NSImage(contentsOf: iconURL) {
|
|
||||||
NSApplication.shared.applicationIconImage = icon
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
|
|
@ -28,6 +22,7 @@ struct KnowledgeRefineryApp: App {
|
||||||
.environmentObject(lmMonitor)
|
.environmentObject(lmMonitor)
|
||||||
.frame(minWidth: 900, minHeight: 600)
|
.frame(minWidth: 900, minHeight: 600)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
|
setAppIcon()
|
||||||
autoStartDaemons()
|
autoStartDaemons()
|
||||||
runSelfTestIfRequested()
|
runSelfTestIfRequested()
|
||||||
}
|
}
|
||||||
|
|
@ -56,6 +51,14 @@ struct KnowledgeRefineryApp: App {
|
||||||
.defaultSize(width: 1300, height: 850)
|
.defaultSize(width: 1300, height: 850)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Set the Dock icon from the bundled .icns file.
|
||||||
|
private func setAppIcon() {
|
||||||
|
if let iconURL = Bundle.module.url(forResource: "AppIcon", withExtension: "icns") {
|
||||||
|
let icon = NSImage(contentsOf: iconURL)
|
||||||
|
NSApp.applicationIconImage = icon
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Auto-start daemons for all workspaces on app launch.
|
/// Auto-start daemons for all workspaces on app launch.
|
||||||
private func autoStartDaemons() {
|
private func autoStartDaemons() {
|
||||||
for ws in workspaceStore.workspaces {
|
for ws in workspaceStore.workspaces {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue