Initial, holiday fun

This commit is contained in:
Ryan McGrath 2018-12-26 18:34:03 -08:00
commit abcab0c509
No known key found for this signature in database
GPG key ID: 811674B62B666830
18 changed files with 2638 additions and 0 deletions

44
four/AppDelegate.swift Normal file
View file

@ -0,0 +1,44 @@
//
// AppDelegate.swift
// four
//
// Created by Ryan McGrath on 12/23/18.
// Copyright © 2018 Ryan McGrath. All rights reserved.
//
import Cocoa
class AppDelegate: NSObject, NSApplicationDelegate {
lazy var popover: NSPopover = {
return NSPopover()
}()
lazy var statusItem: NSStatusItem = {
return NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
}()
func applicationDidFinishLaunching(_ aNotification: Notification) {
popover.behavior = .transient
popover.appearance = NSAppearance.current
popover.contentSize = CGSize(width: 300.0, height: 300.0)
popover.contentViewController = ViewController()
let statusBarIcon = Icons.statusBarIcon()
statusBarIcon.isTemplate = true
statusItem.button?.image = statusBarIcon
statusItem.button?.alternateImage = statusBarIcon
statusItem.button?.action = #selector(togglePopover)
}
func applicationWillTerminate(_ aNotification: Notification) {
}
@objc
func togglePopover(sender: Any?) {
if(popover.isShown) {
popover.performClose(sender)
} else {
popover.show(relativeTo: statusItem.button!.bounds, of: statusItem.button!, preferredEdge: .minY)
}
}
}