1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-10 00:58:37 +00:00

display custom touchbar without control strip and builtin close button

This commit is contained in:
Serg 2018-04-09 13:16:14 +07:00
parent 3d3ad0f076
commit ce7c3c5883
3 changed files with 9 additions and 3 deletions

View File

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

View File

@ -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")

View File

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