Initial commit
This commit is contained in:
54
Ventry Upload Watcher/Ventry_Upload_WatcherApp.swift
Normal file
54
Ventry Upload Watcher/Ventry_Upload_WatcherApp.swift
Normal file
@ -0,0 +1,54 @@
|
||||
//
|
||||
// Ventry_Upload_WatcherApp.swift
|
||||
// Ventry Upload Watcher
|
||||
//
|
||||
// Created by Jan-Marlon Leibl on 18.01.25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import AppKit
|
||||
|
||||
@main
|
||||
struct Ventry_Upload_WatcherApp: App {
|
||||
// MARK: - Properties
|
||||
// MARK: - Scene
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
.fixedSize()
|
||||
}
|
||||
.windowResizability(.contentSize)
|
||||
|
||||
MenuBarExtra {
|
||||
menuContent
|
||||
} label: {
|
||||
menuIcon
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Menu Components
|
||||
@ViewBuilder
|
||||
private var menuContent: some View {
|
||||
Button("Show Window") {
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
NSApp.windows.first?.makeKeyAndOrderFront(nil)
|
||||
}
|
||||
|
||||
Divider()
|
||||
|
||||
Button("Quit") {
|
||||
NSApplication.shared.terminate(nil)
|
||||
}
|
||||
.keyboardShortcut("q")
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var menuIcon: some View {
|
||||
if let nsImage = NSImage(named: "ventry-logo-white") {
|
||||
Image(nsImage: nsImage)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 16, height: 16)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user