Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion MacAssistant/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Log
import AudioKit
import SwiftyUserDefaults
import Preferences
import HotKey

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate, LoginSuccessDelegate {
Expand All @@ -22,12 +23,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, LoginSuccessDelegate {
var audioEngine: AudioEngine!
var streamCall: AssistCall!
let authenticator = Authenticator.instance

let hotKey = HotKey(key: .space, modifiers: [.command, .shift])
let sb = NSStoryboard(name: "Main", bundle: nil)
let assitantWindowControllerID = "AssistantWindowControllerID"
let loginWindowControllerID = "LoginWindowControllerID"
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
lazy var awc = sb.instantiateController(withIdentifier: assitantWindowControllerID) as! AssistantWindowController
lazy var avc = sb.instantiateController(withIdentifier: "AssistantViewControllerID") as! AssistantViewController
lazy var lwc = sb.instantiateController(withIdentifier: loginWindowControllerID) as! LoginWindowController

lazy var preferencesWindowController = PreferencesWindowController(viewControllers: [
Expand All @@ -41,6 +43,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, LoginSuccessDelegate {
statusItem.image = #imageLiteral(resourceName: "statusIcon")
statusItem.action = #selector(toggleWindow)
showAppropriateWindow()
hotKey.keyDownHandler = {
self.showAppropriateWindow()
self.avc.onMicClicked();

}

// preferencesWindowController.showWindow()
}

Expand Down
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ target 'MacAssistant' do
pod 'SwiftyUserDefaults', '4.0.0-alpha.1'
pod 'Preferences'
pod 'KeyHolder'
pod 'HotKey'
end