Feature: add icon

This commit is contained in:
yichengchen 2018-06-23 14:27:04 +08:00
parent fa1c418e82
commit 2ceeb2f21c
8 changed files with 17 additions and 9 deletions

View File

@ -26,9 +26,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
_ = ProxyConfigManager.install()
statusItem = NSStatusBar.system.statusItem(withLength: AppDelegate.StatusItemIconWidth)
let image : NSImage = NSImage(named: NSImage.Name(rawValue: "menu_icon"))!
image.isTemplate = true
statusItem.image = image
statusItem.menu = statusMenu
updateMenuItem()
startProxy()
@ -44,7 +41,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func updateMenuItem(){
proxySettingMenuItem.state = ConfigManager.proxyPortAutoSet ? .on : .off
autoStartMenuItem.state = LaunchAtLogin.isEnabled ? .on:.off
let image = proxySettingMenuItem.state == .on ?
NSImage(named: NSImage.Name(rawValue: "menu_icon"))! :
NSImage(named: NSImage.Name(rawValue: "menu_icon_disabled"))!
statusItem.image = image
}
func startProxy() {
@ -93,8 +94,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@IBAction func actionGenConfig(_ sender: Any) {
let ctrl = NSStoryboard(name: NSStoryboard.Name(rawValue: "Main"), bundle: nil)
.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "sampleConfigGenerator")) as! NSWindowController
genConfigWindow?.close()
genConfigWindow=ctrl
ctrl.window?.title = ctrl.contentViewController?.title ?? ""
ctrl.showWindow(nil)
NSApp.activate(ignoringOtherApps: true)
ctrl.window?.makeKeyAndOrderFront(self)

View File

@ -21,28 +21,33 @@
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"idiom" : "mac",
"filename" : "logo@128.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"idiom" : "mac",
"filename" : "logo@256-1.png",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"idiom" : "mac",
"filename" : "logo@256.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"idiom" : "mac",
"filename" : "logo@512-2.png",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"idiom" : "mac",
"filename" : "logo@512-1.png",
"scale" : "1x"
},
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@ -1 +1 @@
Subproject commit 7dcb8330f06b4789b7b172f6371dcdc22e4aa2ab
Subproject commit 0193d1377f6d424e6712dda1e1fa3d4667b37bd3