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?)