diff --git a/MTMR/AppDelegate.swift b/MTMR/AppDelegate.swift index 3dc5081..d15e6ca 100644 --- a/MTMR/AppDelegate.swift +++ b/MTMR/AppDelegate.swift @@ -10,16 +10,34 @@ import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { - + let statusItem = NSStatusBar.system.statusItem(withLength:NSStatusItem.squareLength) + func applicationDidFinishLaunching(_ aNotification: Notification) { - TouchBarController.shared.setupControlStripPresence() // Insert code here to initialize your application + TouchBarController.shared.setupControlStripPresence() + + if let button = statusItem.button { + button.image = #imageLiteral(resourceName: "StatusImage") + } + createMenu() } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } - + + @objc func testFn(_ sender: Any?) { + let quoteText = "You click on menu" + print(quoteText) + } + + func createMenu() { + let menu = NSMenu() + menu.addItem(withTitle: "Preferences", action: #selector(testFn(_:)), keyEquivalent: ",") + menu.addItem(NSMenuItem.separator()) + menu.addItem(withTitle: "Quit", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q") + statusItem.menu = menu + } } diff --git a/MTMR/Assets.xcassets/StatusImage.imageset/Contents.json b/MTMR/Assets.xcassets/StatusImage.imageset/Contents.json new file mode 100644 index 0000000..89b396a --- /dev/null +++ b/MTMR/Assets.xcassets/StatusImage.imageset/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "StatusImage.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/MTMR/Assets.xcassets/StatusImage.imageset/StatusImage.png b/MTMR/Assets.xcassets/StatusImage.imageset/StatusImage.png new file mode 100644 index 0000000..f5e349a Binary files /dev/null and b/MTMR/Assets.xcassets/StatusImage.imageset/StatusImage.png differ diff --git a/MTMR/Base.lproj/Main.storyboard b/MTMR/Base.lproj/Main.storyboard index f6bf9b9..b059509 100644 --- a/MTMR/Base.lproj/Main.storyboard +++ b/MTMR/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -680,27 +681,6 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/MTMR/Info.plist b/MTMR/Info.plist index 9475e3d..7794de9 100644 --- a/MTMR/Info.plist +++ b/MTMR/Info.plist @@ -2,6 +2,8 @@ + LSUIElement + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable diff --git a/README.md b/README.md index 060ee7a..7028b62 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,12 @@ My the idea is to create the program like a platform for plugins for customizati - [x] First the weather plugin - [x] Find how to open full-screen TouchBar without the cross and stripe menu - [x] Find how to add haptic feedback +- [x] Add icon and menu in StatusBar +- [x] Hide from Dock +- [x] Status menu: "preferences", "quit" - [ ] JSON or another approch for save preset and plugins maybe in `~/mtmr` - [ ] Layout: [always left, NSSliderView for center, always right] - [ ] Custom buttons size, actions by click in settings -- [ ] Add icon and menu in StatusBar -- [ ] Hide from Dock -- [ ] Status menu: "preferences", "quit" - [ ] System for autoupdate (maybe https://sparkle-project.org/) Settings: diff --git a/Resources/MTMRicon.sketch b/Resources/MTMRicon.sketch index 9f0f1d4..691b9b7 100644 Binary files a/Resources/MTMRicon.sketch and b/Resources/MTMRicon.sketch differ