This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
AppDelegate.swift
60 lines (53 loc) · 2.01 KB
/
AppDelegate.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// AppDelegate.swift
// Radio Automne
//
// Created by Aydar Nasibullin on 30.09.2020.
// Copyright © 2020-2021 Fetch Development. All rights reserved.
//
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var nightModeMenuItem: NSMenuItem!
var window = NSWindow(contentRect: NSScreen.main!.frame, styleMask: [], backing: .buffered, defer: false)
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
// MARK: To do in the future but it sucks now because of all the instances and stuff
// func applicationDockMenu(_ sender: NSApplication) -> NSMenu? {
// let myMenu = NSMenu(title: "MyMenu")
// let myMenuItem = NSMenuItem(title: "Toggle", action: #selector(self.playPause), keyEquivalent: "")
// myMenu.addItem(myMenuItem)
// return myMenu
// }
//
// @objc func playPause(){
// if ViewController.playbackControllerState == .paused {
// ViewController.resume()
// } else if ViewController.playbackControllerState == .playing {
// ViewController.pause()
// }
// }
@IBAction func visitJunoPressed(_ sender: Any) {
NSWorkspace.shared.open(URL(string: "https://github.com/Lesterrry/Juno")!)
}
@IBAction func nightModePressed(_ sender: Any) {
switch nightModeMenuItem.state{
case .off:
nightModeMenuItem.state = .on
window.backgroundColor = .black
window.titlebarAppearsTransparent = true
window.center()
window.toggleFullScreen(nil)
let controller = NSWindowController(window: window)
controller.showWindow(self)
window.orderBack(nil)
case .on:
nightModeMenuItem.state = .off
window.close()
default:
nightModeMenuItem.state = .off
window.close()
}
}
}