mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-10 17:08:39 +00:00
display custom touchbar without control strip and builtin close button
This commit is contained in:
parent
3d3ad0f076
commit
ce7c3c5883
@ -22,6 +22,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
|
|||||||
touchBar.delegate = self
|
touchBar.delegate = self
|
||||||
touchBar.defaultItemIdentifiers = [
|
touchBar.defaultItemIdentifiers = [
|
||||||
.escButton,
|
.escButton,
|
||||||
|
.dismissButton,
|
||||||
|
|
||||||
.brightDown,
|
.brightDown,
|
||||||
.brightUp,
|
.brightUp,
|
||||||
@ -55,10 +56,10 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc private func presentTouchBar() {
|
@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)
|
NSTouchBar.minimizeSystemModalFunctionBar(touchBar)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +69,10 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
|
|||||||
let item = NSCustomTouchBarItem(identifier: identifier)
|
let item = NSCustomTouchBarItem(identifier: identifier)
|
||||||
item.view = NSButton(title: "esc", target: self, action: #selector(handleEsc))
|
item.view = NSButton(title: "esc", target: self, action: #selector(handleEsc))
|
||||||
return item
|
return item
|
||||||
|
case .dismissButton:
|
||||||
|
let item = NSCustomTouchBarItem(identifier: identifier)
|
||||||
|
item.view = NSButton(title: "exit", target: self, action: #selector(dismissTouchBar))
|
||||||
|
return item
|
||||||
|
|
||||||
case .brightUp:
|
case .brightUp:
|
||||||
let item = NSCustomTouchBarItem(identifier: identifier)
|
let item = NSCustomTouchBarItem(identifier: identifier)
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import Cocoa
|
|||||||
|
|
||||||
extension NSTouchBarItem.Identifier {
|
extension NSTouchBarItem.Identifier {
|
||||||
static let escButton = NSTouchBarItem.Identifier("com.toxblh.mtmr.escButton")
|
static let escButton = NSTouchBarItem.Identifier("com.toxblh.mtmr.escButton")
|
||||||
|
static let dismissButton = NSTouchBarItem.Identifier("com.toxblh.mtmr.dismissButton")
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
static let volumeUp = NSTouchBarItem.Identifier("com.toxblh.mtmr.volumeUp")
|
static let volumeUp = NSTouchBarItem.Identifier("com.toxblh.mtmr.volumeUp")
|
||||||
|
|||||||
@ -17,6 +17,6 @@ My the idea is to create the program like a platform for plugins for customizati
|
|||||||
- [x] Time in touchbar!
|
- [x] Time in touchbar!
|
||||||
- [ ] First the weather plugin
|
- [ ] First the weather plugin
|
||||||
- [ ] Create the same panel like in my [BTT preset](https://github.com/Toxblh/btt-touchbar-preset)
|
- [ ] 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
|
- [ ] Find how to add haptic feedback
|
||||||
- [ ] Refactoring the application on packages (AppleScript, JavaScript? and Swift?)
|
- [ ] Refactoring the application on packages (AppleScript, JavaScript? and Swift?)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user