Skip to content

Commit

Permalink
Add Edit menu
Browse files Browse the repository at this point in the history
  • Loading branch information
vulgo committed Dec 9, 2021
1 parent 1950e2c commit cb52452
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions usbtool.command
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ extension DispatchQueue {

extension FileHandle: TextOutputStream {
public func write(_ string: String) {
self.write(string.data(using: .utf8)!)
write(string.data(using: .utf8)!)
}
}

Expand Down Expand Up @@ -487,15 +487,21 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
private lazy var mainMenu: NSMenu = {
let processName = ProcessInfo.processInfo.processName
let appMenu = NSMenuItem(title: processName)
appMenu.submenu = NSMenu(title: "Application Menu", items: [
let editMenu = NSMenuItem(title: "Edit")
appMenu.submenu = NSMenu(title: processName, items: [
NSMenuItem(title: "About \(processName)",
action: #selector(NSApplication.orderFrontStandardAboutPanel(_:))),
NSMenuItem.separator(),
NSMenuItem(title: "Quit \(processName)",
action: #selector(NSApplication.terminate(_:)),
keyEquivalent: "q")
])
return NSMenu(title: "Main Menu", items: [appMenu])
editMenu.submenu = NSMenu(title: "Edit", items: [
NSMenuItem(title: "Copy",
action: #selector(NSText.copy(_:)),
keyEquivalent: "c")
])
return NSMenu(title: "Main Menu", items: [appMenu, editMenu])
}()

@objc func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
Expand Down

0 comments on commit cb52452

Please sign in to comment.