Files
rzen 8f8f8b2755 Initial commit: IceGlass NHL game tracker
macOS menu bar app providing NHL game situational awareness with
league-wide scoreboard, dynamic polling, notifications with team
logos, and configurable display options.
2026-04-13 21:44:08 -04:00

58 lines
1.3 KiB
Swift

//
// AboutWindow.swift
// IceGlass
//
// Copyright 2026 Rouslan Zenetl. All Rights Reserved.
//
import SwiftUI
import IndieAbout
@MainActor private var aboutWindowController: NSWindowController?
@MainActor func showAboutWindow() {
if let controller = aboutWindowController {
controller.showWindow(nil)
NSApp.activate(ignoringOtherApps: true)
return
}
let configuration = AppInfoConfiguration(
showDeviceInfo: false,
documents: [
.license(),
.releaseNotes()
]
)
let aboutView = IndieAbout(configuration: configuration)
.frame(width: 300)
let window = NSWindow(
contentRect: .zero,
styleMask: [.titled, .closable],
backing: .buffered,
defer: false
)
window.title = "About IceGlass"
window.contentView = NSHostingView(rootView: aboutView)
window.center()
let controller = NSWindowController(window: window)
aboutWindowController = controller
NotificationCenter.default.addObserver(
forName: NSWindow.willCloseNotification,
object: window,
queue: .main
) { _ in
Task { @MainActor in
aboutWindowController = nil
}
}
controller.showWindow(nil)
NSApp.activate(ignoringOtherApps: true)
}