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.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// 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)
|
||||
}
|
||||
Reference in New Issue
Block a user