1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-11 17:38:38 +00:00

Merge pull request #85 from ReDetection/fix-open-and-reset

fix broken close/open and toggle control strip
This commit is contained in:
Anton Palgunov 2018-05-26 10:39:01 +01:00 committed by GitHub
commit 7f13422805
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,7 +90,10 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
SupportedTypesHolder.sharedInstance.register(typename: "exitTouchbar", item: .staticButton(title: "exit"), action: .custom(closure: { [weak self] in self?.dismissTouchBar()}), longAction: .none)
SupportedTypesHolder.sharedInstance.register(typename: "close") { _ in
return (item: .staticButton(title: ""), action: .custom(closure: { [weak self] in self?.touchbarNeedRefresh = true; self?.createAndUpdatePreset() }), longAction: .none, parameters: [.width: .width(30), .image: .image(source: (NSImage(named: .stopProgressFreestandingTemplate))!)])
return (item: .staticButton(title: ""), action: .custom(closure: { [weak self] in
self?.touchbarNeedRefresh = true
self?.createAndUpdatePreset()
}), longAction: .none, parameters: [.width: .width(30), .image: .image(source: (NSImage(named: .stopProgressFreestandingTemplate))!)])
}
if let blackListed = UserDefaults.standard.stringArray(forKey: "com.toxblh.mtmr.blackListedApps") {
@ -216,11 +219,12 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
}
@objc func resetControlStrip() {
NSTouchBar.minimizeSystemModalFunctionBar(self.touchBar)
dismissTouchBar()
presentTouchBar()
}
@objc private func dismissTouchBar() {
self.touchbarNeedRefresh = true
NSTouchBar.minimizeSystemModalFunctionBar(touchBar)
}