in HuggingChat-Mac/AppDelegate.swift [51:95]
func applicationDidFinishLaunching(_ notification: Notification) {
createFloatingPanel()
newEntryPanel.center()
createTranscriptionPanel()
// Set keyboard shortcut
KeyboardShortcuts.onKeyUp(for: .showFloatingPanel, action: {
self.toggleFloatingPanel()
})
KeyboardShortcuts.onKeyUp(for: .toggleLocalGeneration, action: {
if self.selectedLocalModel != "None" {
self.isLocalGeneration.toggle()
}
})
KeyboardShortcuts.onKeyDown(for: .showTranscriptionPanel, action: {
self.handleKeyDown()
})
KeyboardShortcuts.onKeyUp(for: .showTranscriptionPanel, action: {
self.handleKeyUp()
})
// Check hide dock status
NSApp.setActivationPolicy(hideDock ? .accessory : .regular)
// Setup local model if needed
if selectedLocalModel != "None" {
if let selectedLocalModel = modelManager.availableModels.first(where: { $0.displayName == selectedLocalModel }) {
Task {
await modelManager.localModelDidChange(to: selectedLocalModel)
}
}
}
// Setup transcription model if needed
audioModelManager.setupMicrophone()
if selectedAudioModel != "None" {
audioModelManager.loadModel(selectedAudioModel)
}
createMenuBarItem()
}