diff --git a/MTMR.xcodeproj/project.pbxproj b/MTMR.xcodeproj/project.pbxproj index a0dff76..1660ec5 100644 --- a/MTMR.xcodeproj/project.pbxproj +++ b/MTMR.xcodeproj/project.pbxproj @@ -40,6 +40,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 36C2ECD2207B3B1D003CDA33 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; B059D621205E03F5006E6B86 /* TouchBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchBarController.swift; sourceTree = ""; }; B059D623205E04F3006E6B86 /* TouchBarItems.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchBarItems.swift; sourceTree = ""; }; B059D629205E13E5006E6B86 /* TouchBarPrivateApi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TouchBarPrivateApi.h; sourceTree = ""; }; @@ -102,6 +103,7 @@ B082B246205C7D8000BC04DC = { isa = PBXGroup; children = ( + 36C2ECD2207B3B1D003CDA33 /* README.md */, B082B251205C7D8000BC04DC /* MTMR */, B082B264205C7D8000BC04DC /* MTMRTests */, B082B26F205C7D8000BC04DC /* MTMRUITests */, diff --git a/MTMR/TouchBarController.swift b/MTMR/TouchBarController.swift index c3a622d..4627ad1 100644 --- a/MTMR/TouchBarController.swift +++ b/MTMR/TouchBarController.swift @@ -22,6 +22,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate { touchBar.delegate = self touchBar.defaultItemIdentifiers = [ .escButton, + .dismissButton, .brightDown, .brightUp, @@ -55,10 +56,10 @@ class TouchBarController: NSObject, NSTouchBarDelegate { } @objc private func presentTouchBar() { - NSTouchBar.presentSystemModalFunctionBar(touchBar, systemTrayItemIdentifier: .controlStripItem) + NSTouchBar.presentSystemModalFunctionBar(touchBar, placement: 1, systemTrayItemIdentifier: .controlStripItem) } - private func dismissTouchBar() { + @objc private func dismissTouchBar() { NSTouchBar.minimizeSystemModalFunctionBar(touchBar) } @@ -68,6 +69,10 @@ class TouchBarController: NSObject, NSTouchBarDelegate { let item = NSCustomTouchBarItem(identifier: identifier) item.view = NSButton(title: "esc", target: self, action: #selector(handleEsc)) return item + case .dismissButton: + let item = NSCustomTouchBarItem(identifier: identifier) + item.view = NSButton(title: "exit", target: self, action: #selector(dismissTouchBar)) + return item case .brightUp: let item = NSCustomTouchBarItem(identifier: identifier) diff --git a/MTMR/TouchBarItems.swift b/MTMR/TouchBarItems.swift index 3799c4e..5da58c0 100644 --- a/MTMR/TouchBarItems.swift +++ b/MTMR/TouchBarItems.swift @@ -10,6 +10,7 @@ import Cocoa extension NSTouchBarItem.Identifier { static let escButton = NSTouchBarItem.Identifier("com.toxblh.mtmr.escButton") + static let dismissButton = NSTouchBarItem.Identifier("com.toxblh.mtmr.dismissButton") // Volume static let volumeUp = NSTouchBarItem.Identifier("com.toxblh.mtmr.volumeUp") diff --git a/README.md b/README.md index 9d58d39..fc1194f 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,6 @@ My the idea is to create the program like a platform for plugins for customizati - [x] Time in touchbar! - [ ] First the weather plugin - [ ] Create the same panel like in my [BTT preset](https://github.com/Toxblh/btt-touchbar-preset) -- [ ] Find how to open full-screen TouchBar without the cross and stripe menu +- [x] Find how to open full-screen TouchBar without the cross and stripe menu - [ ] Find how to add haptic feedback - [ ] Refactoring the application on packages (AppleScript, JavaScript? and Swift?)