Skip to content

Commit

Permalink
Add project website link
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunn committed Sep 21, 2020
1 parent 07ec7f0 commit 92efeed
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions UTMBeGone/Menu/MenuManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ class MenuManager: NSObject {
let preferencesItem = NSMenuItem(title: "Preferences", action: #selector(MenuManager.openPreferences), keyEquivalent: "")
preferencesItem.target = self
menu.addItem(preferencesItem)

let launchAtLoginItem = NSMenuItem(title: "Launch at Login ", action: #selector(MenuManager.toggleLaunchAtLogin), keyEquivalent: "")
launchAtLoginItem.target = self
launchAtLoginItem.state = launchAtLoginEnabled ? .on : .off
menu.addItem(launchAtLoginItem)


if stopped {
let resumeMenuItem = NSMenuItem(title: "Resume ", action: #selector(MenuManager.resume), keyEquivalent: "")
resumeMenuItem.target = self
Expand All @@ -78,10 +73,19 @@ class MenuManager: NSObject {
menu.addItem(stopMenuItem)
}

let launchAtLoginItem = NSMenuItem(title: "Launch at Login ", action: #selector(MenuManager.toggleLaunchAtLogin), keyEquivalent: "")
launchAtLoginItem.target = self
launchAtLoginItem.state = launchAtLoginEnabled ? .on : .off
menu.addItem(launchAtLoginItem)

let removeFromMenuItem = NSMenuItem(title: "Hide Icon ", action: #selector(MenuManager.removeFromMenu), keyEquivalent: "")
removeFromMenuItem.target = self
menu.addItem(removeFromMenuItem)

let websiteItem = NSMenuItem(title: "Project Website", action: #selector(MenuManager.openProjectWebsite), keyEquivalent: "")
websiteItem.target = self
menu.addItem(websiteItem)

let quitMenuItem = NSMenuItem(title: "Quit", action: #selector(MenuManager.quit), keyEquivalent: "")
quitMenuItem.target = self
menu.addItem(quitMenuItem)
Expand Down Expand Up @@ -129,6 +133,10 @@ extension MenuManager {
setupMenu()
}

@objc private func openProjectWebsite() {
NSWorkspace.shared.open(URL(string: "https://github.com/Bunn/UTMBeGone")!)
}

@objc private func quit() {
NSApplication.shared.terminate(self)
}
Expand Down

0 comments on commit 92efeed

Please sign in to comment.