mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-10-31 10:28:36 +00:00
display custom touchbar without control strip and builtin close button
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user