mirror of
https://github.com/VGEAREN/Stockbar.git
synced 2026-10-07 16:47:58 +08:00
- Fix "daily + total" PnL mode only showing daily: use single Text concatenation - Move PnL options into status bar picker (daily / total / both), hide icon in PnL mode - Add rounded corners to app icon for macOS consistency - Add LaunchAgent plist fallback for launch-at-login on Intel Macs - Remove StatusBarPnL enum, use statusBarStockId special values instead Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
1.1 KiB
Swift
39 lines
1.1 KiB
Swift
import SwiftUI
|
|
import AppKit
|
|
import os
|
|
|
|
class AppDelegate: NSObject, NSApplicationDelegate {
|
|
func applicationDidFinishLaunching(_ notification: Notification) {
|
|
appLogger.info("applicationDidFinishLaunching")
|
|
logToFile("applicationDidFinishLaunching — pid=\(ProcessInfo.processInfo.processIdentifier)")
|
|
}
|
|
|
|
func applicationWillTerminate(_ notification: Notification) {
|
|
appLogger.warning("applicationWillTerminate")
|
|
logToFile("applicationWillTerminate")
|
|
}
|
|
|
|
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
|
|
appLogger.warning("applicationShouldTerminate called")
|
|
logToFile("applicationShouldTerminate called")
|
|
return .terminateNow
|
|
}
|
|
}
|
|
|
|
@main
|
|
struct StockbarApp: App {
|
|
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
|
|
@StateObject private var appState = AppState()
|
|
|
|
var body: some Scene {
|
|
MenuBarExtra {
|
|
DropdownView()
|
|
.environmentObject(appState)
|
|
} label: {
|
|
MenuBarLabel()
|
|
.environmentObject(appState)
|
|
}
|
|
.menuBarExtraStyle(.window)
|
|
}
|
|
}
|