statusItem.isVisible = true
statusItem.menu = NSMenu()
- let recordItem = NSMenuItem(title: "record", action: #selector(CapturaAppDelegate.onClickStartRecording), keyEquivalent: "6")
+ let recordItem = NSMenuItem(title: "Record", action: #selector(CapturaAppDelegate.onClickStartRecording), keyEquivalent: "6")
recordItem.keyEquivalentModifierMask = [.command, .shift]
statusItem.menu?.addItem(recordItem)
+ statusItem.menu?.addItem(NSMenuItem.separator())
+
+ let preferencesItem = NSMenuItem(title: "Preferences", action: #selector(CapturaAppDelegate.onOpenPreferences), keyEquivalent: "")
+ statusItem.menu?.addItem(preferencesItem)
+
+ let quitItem = NSMenuItem(title: "Quit", action: #selector(CapturaAppDelegate.onQuit), keyEquivalent: "")
+ statusItem.menu?.addItem(quitItem)
}
private func closeWindow() {
NotificationCenter.default.post(name: .startAreaSelection, object: nil, userInfo: nil)
}
+ @objc private func onOpenPreferences() {
+ print("Preferences pressed")
+ }
+
+ @objc private func onQuit() {
+ NSApplication.shared.terminate(self)
+ }
+
// MARK: - App State Event Listeners
if captureState != .selectingArea {
captureState = .selectingArea
recordingWindow = RecordingWindow()
- print("Recording")
}
}
func reset() {
captureState = .idle
+ recordingWindow?.close()
+ self.recordingWindow = nil
}
}